Commit cfede9da by Kim Eunchul

#39714 andやor検索(検索語5つ制限)

parent 78373de5
...@@ -1048,6 +1048,7 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1048,6 +1048,7 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
var myArray = []; var myArray = [];
var myQuery; var myQuery;
var myRegExpArr = []; var myRegExpArr = [];
var count = 0;
do { do {
var match = myRegexp.exec($('#txtSearchWs').val()); var match = myRegexp.exec($('#txtSearchWs').val());
...@@ -1064,10 +1065,12 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1064,10 +1065,12 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
}else{ }else{
myRegExpArr[0] = new RegExp(myArray[0].slice(1)); myRegExpArr[0] = new RegExp(myArray[0].slice(1));
myQuery = '( true' myQuery = '( true'
count++;
} }
}else{ }else{
myRegExpArr[0] = new RegExp(myArray[0]); myRegExpArr[0] = new RegExp(myArray[0]);
myQuery = 'true'; myQuery = 'true';
count++;
} }
for (var i = 1; i < myArray.length; i++){ for (var i = 1; i < myArray.length; i++){
...@@ -1084,9 +1087,11 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1084,9 +1087,11 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(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';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i].slice(1)); myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' && ( true'; myQuery += ' && ( true';
count++;
} }
} }
}else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){ }else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){
...@@ -1096,22 +1101,27 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1096,22 +1101,27 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1)); myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' || true )'; myQuery += ' || true )';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1)); myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' && true )'; myQuery += ' && true )';
count++;
} }
} }
}else{ }else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' || true'; myQuery += ' || true';
count++;
}else{ }else{
if(myArray[i - 1] == "("){ if(myArray[i - 1] == "("){
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' true'; myQuery += ' true';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' && true'; myQuery += ' && true';
count++;
} }
} }
} }
...@@ -1126,6 +1136,11 @@ CONTENTSEARCH.searchEventButtonFunction = function() { ...@@ -1126,6 +1136,11 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
return; return;
} }
if(count > 5){
alert('語句数は最大5つです');
return;
}
if(CONTENTSEARCH.overClick()){ if(CONTENTSEARCH.overClick()){
return; return;
} }
......
...@@ -746,6 +746,7 @@ CONTENTVIEW.searchHandle = function() { ...@@ -746,6 +746,7 @@ CONTENTVIEW.searchHandle = function() {
var myArray = []; var myArray = [];
var myQuery; var myQuery;
var myRegExpArr = []; var myRegExpArr = [];
var count = 0;
try{ try{
do { do {
...@@ -762,11 +763,13 @@ CONTENTVIEW.searchHandle = function() { ...@@ -762,11 +763,13 @@ CONTENTVIEW.searchHandle = function() {
myQuery = '( myRegExpArr[1].test(contentPage[nIndex].pageText)'; myQuery = '( myRegExpArr[1].test(contentPage[nIndex].pageText)';
}else{ }else{
myRegExpArr[0] = new RegExp(myArray[0].slice(1)); myRegExpArr[0] = new RegExp(myArray[0].slice(1));
myQuery = '( myRegExpArr[0].test(contentPage[nIndex].pageText)' myQuery = '( myRegExpArr[0].test(contentPage[nIndex].pageText)';
count++;
} }
}else{ }else{
myRegExpArr[0] = new RegExp(myArray[0]); myRegExpArr[0] = new RegExp(myArray[0]);
myQuery = 'myRegExpArr[0].test(contentPage[nIndex].pageText)'; myQuery = 'myRegExpArr[0].test(contentPage[nIndex].pageText)';
count++;
} }
for (var i = 1; i < myArray.length; i++){ for (var i = 1; i < myArray.length; i++){
...@@ -783,9 +786,11 @@ CONTENTVIEW.searchHandle = function() { ...@@ -783,9 +786,11 @@ CONTENTVIEW.searchHandle = function() {
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(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 += ' || ( myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)'; myQuery += ' || ( myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i].slice(1)); myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' && ( myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)'; myQuery += ' && ( myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)';
count++;
} }
} }
}else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){ }else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){
...@@ -795,22 +800,27 @@ CONTENTVIEW.searchHandle = function() { ...@@ -795,22 +800,27 @@ CONTENTVIEW.searchHandle = function() {
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1)); myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' || myRegExpArr[' + i + '].test(contentPage[nIndex].pageText) )'; myQuery += ' || myRegExpArr[' + i + '].test(contentPage[nIndex].pageText) )';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1)); myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' && myRegExpArr[' + i + '].test(contentPage[nIndex].pageText) )'; myQuery += ' && myRegExpArr[' + i + '].test(contentPage[nIndex].pageText) )';
count++;
} }
} }
}else{ }else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' || myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)'; myQuery += ' || myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)';
count++;
}else{ }else{
if(myArray[i - 1] == "("){ if(myArray[i - 1] == "("){
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)'; myQuery += ' myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' && myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)'; myQuery += ' && myRegExpArr[' + i + '].test(contentPage[nIndex].pageText)';
count++;
} }
} }
} }
...@@ -828,6 +838,11 @@ CONTENTVIEW.searchHandle = function() { ...@@ -828,6 +838,11 @@ CONTENTVIEW.searchHandle = function() {
return; return;
} }
if(count > 5){
alert('語句数は最大5つです');
return;
}
if (sPageNo.length > 0) { if (sPageNo.length > 0) {
//title start //title start
$('#bookmarkBoxHdSearching').children().remove(); $('#bookmarkBoxHdSearching').children().remove();
......
...@@ -276,6 +276,7 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -276,6 +276,7 @@ HEADER.searchHeaderButtonFunction = function(){
var myArray = []; var myArray = [];
var myQuery; var myQuery;
var myRegExpArr = []; var myRegExpArr = [];
var count = 0;
do { do {
var match = myRegexp.exec($('#searchbox-key').val()); var match = myRegexp.exec($('#searchbox-key').val());
...@@ -292,10 +293,12 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -292,10 +293,12 @@ HEADER.searchHeaderButtonFunction = function(){
}else{ }else{
myRegExpArr[0] = new RegExp(myArray[0].slice(1)); myRegExpArr[0] = new RegExp(myArray[0].slice(1));
myQuery = '( true' myQuery = '( true'
count++;
} }
}else{ }else{
myRegExpArr[0] = new RegExp(myArray[0]); myRegExpArr[0] = new RegExp(myArray[0]);
myQuery = 'true'; myQuery = 'true';
count++;
} }
for (var i = 1; i < myArray.length; i++){ for (var i = 1; i < myArray.length; i++){
...@@ -312,9 +315,11 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -312,9 +315,11 @@ HEADER.searchHeaderButtonFunction = function(){
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(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';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i].slice(1)); myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' && ( true'; myQuery += ' && ( true';
count++;
} }
} }
}else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){ }else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){
...@@ -324,22 +329,27 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -324,22 +329,27 @@ HEADER.searchHeaderButtonFunction = function(){
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1)); myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' || true )'; myQuery += ' || true )';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1)); myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' && true )'; myQuery += ' && true )';
count++;
} }
} }
}else{ }else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){ if(myArray[i - 1] == "OR" || myArray[i - 1] == "or"){
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' || true'; myQuery += ' || true';
count++;
}else{ }else{
if(myArray[i - 1] == "("){ if(myArray[i - 1] == "("){
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' true'; myQuery += ' true';
count++;
}else{ }else{
myRegExpArr[i] = new RegExp(myArray[i]); myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' && true'; myQuery += ' && true';
count++;
} }
} }
} }
...@@ -354,6 +364,11 @@ HEADER.searchHeaderButtonFunction = function(){ ...@@ -354,6 +364,11 @@ HEADER.searchHeaderButtonFunction = function(){
return; return;
} }
if(count > 5){
alert('語句数は最大5つです');
return;
}
if(HEADER.overClick()){ if(HEADER.overClick()){
return; return;
} }
......
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