Commit cfede9da by Kim Eunchul

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

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