Apache Solr open-source search software
Escapes the / character for FireFox 1.0.
Kelvin Tan96c0bf9c90e4
diff --git a/sandbox/contributions/javascript/queryValidator/luceneQueryValidator.js b/sandbox/contributions/javascript/queryValidator/luceneQueryValidator.jsindex 4ffa0aa3223..6c02c347bc3 100644--- a/sandbox/contributions/javascript/queryValidator/luceneQueryValidator.js+++ b/sandbox/contributions/javascript/queryValidator/luceneQueryValidator.js@@ -103,7 +103,7 @@ function removeEscapes(query)function checkAllowedCharacters(query){- matches = query.match(/[^a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'= ]/);+ matches = query.match(/[^a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'= ]/);if(matches != null && matches.length > 0){if(alertUser) alert("Invalid search query! The allowed characters are a-z A-Z 0-9. _ + - : () \" & * ? | ! {} [ ] ^ ~ \\ @ = # % $ ' /. Please try again.")@@ -129,7 +129,7 @@ function checkAmpersands(query)matches = query.match(/[&]{2}/);if(matches != null && matches.length > 0){- matches = query.match(/^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'=]+( && )?[a-zA-Z0-9_+\-:.()\"*?|!{}\[\]\^~\\@#/$%'=]+[ ]*)+$/); // note missing & in pattern+ matches = query.match(/^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]+( && )?[a-zA-Z0-9_+\-:.()\"*?|!{}\[\]\^~\\@#\/$%'=]+[ ]*)+$/); // note missing & in patternif(matches == null){if(alertUser) alert("Invalid search query! Queries containing the special characters && must be in the form: term1 && term2. Please try again.")@@ -141,7 +141,7 @@ function checkAmpersands(query)function checkCaret(query){- //matches = query.match(/^[^\^]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\~\\@#/]+(\^[\d]+)?[ ]*)+$/); // note missing ^ in pattern+ //matches = query.match(/^[^\^]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\~\\@#\/]+(\^[\d]+)?[ ]*)+$/); // note missing ^ in patternmatches = query.match(/[^\\]\^([^\s]*[^0-9.]+)|[^\\]\^$/);if(matches != null){@@ -153,7 +153,7 @@ function checkCaret(query)function checkSquiggle(query){- //matches = query.match(/^[^~]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^\\@#/]+(~[\d.]+|[^\\]\\~)?[ ]*)+$/); // note missing ~ in pattern+ //matches = query.match(/^[^~]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^\\@#\/]+(~[\d.]+|[^\\]\\~)?[ ]*)+$/); // note missing ~ in patternmatches = query.match(/[^\\]~[^\s]*[^0-9\s]+/);if(matches != null){@@ -167,7 +167,7 @@ function checkExclamationMark(query){// foo! is not a query, but !foo is. hmmmm...// NB: doesn't handle term1 ! term2 ! term3 or term1 !term2- matches = query.match(/^[^!]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'=]+( ! )?[a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'=]+[ ]*)+$/);+ matches = query.match(/^[^!]*$|^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]+( ! )?[a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]+[ ]*)+$/);if(matches == null || matches.length == 0){if(alertUser) alert("Invalid search query! Queries containing the special character ! must be in the form: term1 ! term2. Please try again.")@@ -180,7 +180,7 @@ function checkExclamationMark(query)function checkQuestionMark(query){- matches = query.match(/^(\?)|([^a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#/$%'=]\?+)/);+ matches = query.match(/^(\?)|([^a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]\?+)/);if(matches != null && matches.length > 0){if(alertUser) alert("Invalid search query! The question mark (?) character must be preceded by at least one alphabet or number. Please try again.")@@ -226,7 +226,7 @@ function checkParentheses(query)function checkPlusMinus(query){- matches = query.match(/^[^\n+\-]*$|^([+-]?[a-zA-Z0-9_:.()\"*?&|!{}\[\]\^~\\@#/$%'=]+[ ]?)+$/);+ matches = query.match(/^[^\n+\-]*$|^([+-]?[a-zA-Z0-9_:.()\"*?&|!{}\[\]\^~\\@#\/$%'=]+[ ]?)+$/);if(matches == null || matches.length == 0){if(alertUser) alert("Invalid search query! '+' and '-' modifiers must be followed by at least one alphabet or number. Please try again.")@@ -240,7 +240,7 @@ function checkANDORNOT(query)matches = query.match(/AND|OR|NOT/);if(matches != null && matches.length > 0){- matches = query.match(/^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@/#$%'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@/#$%'=]+[ ]*)+$/);+ matches = query.match(/^([a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%'=]+\s*((AND )|(OR )|(AND NOT )|(NOT ))?[a-zA-Z0-9_+\-:.()\"*?&|!{}\[\]\^~\\@\/#$%'=]+[ ]*)+$/);if(matches == null || matches.length == 0){if(alertUser) alert("Invalid search query! Queries containing AND/OR/NOT must be in the form: term1 AND|OR|NOT|AND NOT term2 Please try again.")