Commit f8b7f9f8 by Kim Eunchul

#40821 【TECSS Web 1.9.2.6】「or」「(」「半角スペース」で検索した時の結果が統一されていない

parent caa4122c
...@@ -1048,10 +1048,11 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1048,10 +1048,11 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
//seperate string //seperate string
var myRegexp = /[^\s"]+|"([^"]*)"/gi; var myRegexp = /[^\s"]+|"([^"]*)"/gi;
var myArray = []; var myArray = [];
var dummyArray = [];
var myQuery; var myQuery;
//var myRegExpArr = []; //var myRegExpArr = [];
var textReg = $('#txtSearchWs').val().replace(/\(/g," ( ").replace(/\)/g," ) "); var textReg = $('#txtSearchWs').val().replace(/\(/g," ( ").replace(/\)/g," ) ");
var dummytextReg = $('#txtSearchWs').val().replace(/\"/g,"'\"'");
do { do {
var match = myRegexp.exec(textReg); var match = myRegexp.exec(textReg);
if (match != null) if (match != null)
...@@ -1060,12 +1061,26 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1060,12 +1061,26 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
} }
} while (match != null); } while (match != null);
do {
var match = myRegexp.exec(dummytextReg);
if (match != null)
{
dummyArray.push(match[1] ? match[1] : match[0]);
}
} while (match != null);
for(var i = 0; i < myArray.length; i++){ for(var i = 0; i < myArray.length; i++){
if(myArray[i] != "OR" && myArray[i] != "or" && myArray[i] != "Or" && myArray[i] != "oR" && myArray[i] != "(" && myArray[i] != ")"){ if(myArray[i] != "OR" && myArray[i] != "or" && myArray[i] != "Or" && myArray[i] != "oR" && myArray[i] != "(" && myArray[i] != ")"){
count++; count++;
} }
} }
for(var i = 0; i < dummyArray.length; i++){
if(dummyArray[i].includes(")(") && dummyArray[i].charAt(0) != "'" && dummyArray[i].charAt(dummyArray.length - 1) != "'"){
searchText = ")";
}
}
if(count > 5){ if(count > 5){
alert('語句数は最大5つです'); alert('語句数は最大5つです');
return; return;
......
...@@ -749,6 +749,10 @@ CONTENTVIEW.searchHandle = function() { ...@@ -749,6 +749,10 @@ CONTENTVIEW.searchHandle = function() {
var count = 0; var count = 0;
var textReg = $('#txtSearch').val().replace(/\(/g," \( ").replace(/\)/g," \) "); var textReg = $('#txtSearch').val().replace(/\(/g," \( ").replace(/\)/g," \) ");
//)(check
var dummyArray = [];
var dummytextReg = $('#txtSearch').val().replace(/\"/g,"'\"'");
if($('#txtSearch').val() == '"("'){ if($('#txtSearch').val() == '"("'){
myRegExpArr[0] = new RegExp("[\(]"); myRegExpArr[0] = new RegExp("[\(]");
for (var nIndex = 0; nIndex < contentPage.length; nIndex++) { for (var nIndex = 0; nIndex < contentPage.length; nIndex++) {
...@@ -794,6 +798,21 @@ CONTENTVIEW.searchHandle = function() { ...@@ -794,6 +798,21 @@ CONTENTVIEW.searchHandle = function() {
}else{ }else{
try{ try{
do {
var match = myRegexp.exec(dummytextReg);
if (match != null)
{
dummyArray.push(match[1] ? match[1] : match[0]);
}
} while (match != null);
for(var i = 0; i < dummyArray.length; i++){
if(dummyArray[i].includes(")(") && dummyArray[i].charAt(0) != "'" && dummyArray[i].charAt(dummyArray.length - 1) != "'"){
throw new Error('quotes error!')
}
}
do { do {
var match = myRegexp.exec(textReg); var match = myRegexp.exec(textReg);
if (match != null) if (match != null)
......
...@@ -279,6 +279,16 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -279,6 +279,16 @@ HEADER.searchHeaderButtonFunction = function(){
var myQuery; var myQuery;
//var myRegExpArr = []; //var myRegExpArr = [];
var textReg = $('#searchbox-key').val().replace(/\(/g," ( ").replace(/\)/g," ) "); var textReg = $('#searchbox-key').val().replace(/\(/g," ( ").replace(/\)/g," ) ");
var dummyArray = [];
var dummytextReg = $('#searchbox-key').val().replace(/\"/g,"'\"'");
do {
var match = myRegexp.exec(dummytextReg);
if (match != null)
{
dummyArray.push(match[1] ? match[1] : match[0]);
}
} while (match != null);
do { do {
var match = myRegexp.exec(textReg); var match = myRegexp.exec(textReg);
...@@ -367,6 +377,12 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -367,6 +377,12 @@ HEADER.searchHeaderButtonFunction = function(){
myQuery += ' &&'; myQuery += ' &&';
} }
for(var i = 0; i < dummyArray.length; i++){
if(dummyArray[i].includes(")(") && dummyArray[i].charAt(0) != "'" && dummyArray[i].charAt(dummyArray.length - 1) != "'"){
myQuery += ' &&';
}
}
if (eval(myQuery)) { if (eval(myQuery)) {
//is not correct query //is not correct query
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment