Commit af35356b by Kim Eunchul

#40770 【TECSS Web 1.9.2.6】検索調査依頼

parent d05485a2
...@@ -1050,7 +1050,7 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1050,7 +1050,7 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
var myArray = []; var myArray = [];
var myQuery; var myQuery;
//var myRegExpArr = []; //var myRegExpArr = [];
var textReg = $('#txtSearchWs').val().replace("("," ( ").replace(")"," ) "); var textReg = $('#txtSearchWs').val().replace(/\(/g," ( ").replace(/\)/g," ) ");
do { do {
var match = myRegexp.exec(textReg); var match = myRegexp.exec(textReg);
...@@ -1089,16 +1089,20 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1089,16 +1089,20 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
if(myArray[i] == "("){ if(myArray[i] == "("){
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myQuery += ' || ('; myQuery += ' || (';
}else{ }else if(myArray[i - 1] != "("){
myQuery += ' && ('; myQuery += ' && (';
}else{
myQuery += ' (';
} }
}else{ }else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
//myRegExpArr[i] = new RegExp(myArray[i].slice(1)); //myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' || ( true'; myQuery += ' || ( true';
}else{ }else if(myArray[i - 1] != "("){
//myRegExpArr[i] = new RegExp(myArray[i].slice(1)); //myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' && ( true'; myQuery += ' && ( true';
}else{
myQuery += ' ( true';
} }
} }
}else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){ }else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){
......
...@@ -272,13 +272,12 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -272,13 +272,12 @@ HEADER.searchHeaderButtonFunction = function(){
} }
if ($('#searchbox-key').val() != ' ' && $('#searchbox-key').val() != ' ' && $('#searchbox-key').val() != '') { if ($('#searchbox-key').val() != ' ' && $('#searchbox-key').val() != ' ' && $('#searchbox-key').val() != '') {
try{ try{
//seperate string //seperate string
var myRegexp = /[^\s"]+|"([^"]*)"/gi; var myRegexp = /[^\s"]+|"([^"]*)"/gi;
var myArray = []; var myArray = [];
var myQuery; var myQuery;
var myRegExpArr = []; //var myRegExpArr = [];
var textReg = $('#searchbox-key').val().replace("("," ( ").replace(")"," ) "); var textReg = $('#txtSearchWs').val().replace(/\(/g," ( ").replace(/\)/g," ) ");
do { do {
var match = myRegexp.exec(textReg); var match = myRegexp.exec(textReg);
...@@ -286,31 +285,30 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -286,31 +285,30 @@ HEADER.searchHeaderButtonFunction = function(){
{ {
myArray.push(match[1] ? match[1] : match[0]); myArray.push(match[1] ? match[1] : match[0]);
} }
} while (match != null); } 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++;
} }
} }
console.log(myArray);
if(count > 5){ if(count > 5){
alert('語句数は最大5つです'); alert('語句数は最大5つです');
return; return;
} }
if(myArray[0].charAt(0) == "("){ if(myArray[0].charAt(0) == "("){
if(myArray[0] == "("){ if(myArray[0] == "("){
//myRegExpArr[1] = new RegExp(myArray[1]); //myRegExpArr[1] = new RegExp(myArray[1]);
myQuery = '( true'; myQuery = '(';
}else{ }else{
//myRegExpArr[0] = new RegExp(myArray[0].slice(1)); //myRegExpArr[0] = new RegExp(myArray[0].slice(1));
myQuery = '( true'; myQuery = '(';
} }
}else{ }else{
//myRegExpArr[0] = new RegExp(myArray[0]); //myRegExpArr[0] = new RegExp(myArray[0]);
myQuery = 'true'; myQuery = 'true';
} }
for (var i = 1; i < myArray.length; i++){ for (var i = 1; i < myArray.length; i++){
if(myArray[i] == "OR" || myArray[i] == "or" || myArray[i] == "Or" || myArray[i] == "oR"){ if(myArray[i] == "OR" || myArray[i] == "or" || myArray[i] == "Or" || myArray[i] == "oR"){
//myRegExpArr[i] = new RegExp(myArray[i]); //myRegExpArr[i] = new RegExp(myArray[i]);
...@@ -318,16 +316,20 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -318,16 +316,20 @@ HEADER.searchHeaderButtonFunction = function(){
if(myArray[i] == "("){ if(myArray[i] == "("){
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myQuery += ' || ('; myQuery += ' || (';
}else{ }else if(myArray[i - 1] != "("){
myQuery += ' && ('; myQuery += ' && (';
}else{
myQuery += ' (';
} }
}else{ }else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
//myRegExpArr[i] = new RegExp(myArray[i].slice(1)); //myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' || ( true'; myQuery += ' || ( true';
}else{ }else if(myArray[i - 1] != "("){
//myRegExpArr[i] = new RegExp(myArray[i].slice(1)); //myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' && ( true'; myQuery += ' && ( true';
}else{
myQuery += ' ( true';
} }
} }
}else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){ }else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){
......
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