SOLR-4333: edismax to not double-escape colons if already escaped by client application

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1470577 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Dyer 2013-04-22 15:31:04 +00:00
parent 60ffa638b6
commit a24f93e728
3 changed files with 13 additions and 1 deletions

View File

@ -64,6 +64,9 @@ Bug Fixes
* SOLR-4741: Deleting a collection should set DELETE_DATA_DIR to true.
(Mark Miller)
* SOLR-4333: edismax parser to not double-escape colons if already escaped by
the client application (James Dyer, Robert J. van der Boon)
Other Changes
----------------------

View File

@ -812,7 +812,7 @@ public class ExtendedDismaxQParser extends QParser {
clause.raw = s.substring(start, pos);
// escape colons, except for "match all" query
if(!"*:*".equals(clause.raw)) {
clause.raw = clause.raw.replaceAll(":", "\\\\:");
clause.raw = clause.raw.replaceAll("([^\\\\]):", "$1\\\\:");
}
} else {
clause.raw = s.substring(start, pos);

View File

@ -847,6 +847,15 @@ public class TestExtendedDismaxParser extends SolrTestCaseJ4 {
"defType", "edismax")
, "*[count(//doc)=1]");
assertQ(
"Might be double-escaping a client-escaped colon",
req("q", "text_sw:(theos OR thistokenhasa\\:preescapedcolon OR theou)", "defType", "edismax", "qf", "id"),
"*[count(//doc)=3]");
assertQ(
"Might be double-escaping a client-escaped colon",
req("q", "text_sw:(theos OR thistokenhasa\\:preescapedcolon OR theou)", "defType", "edismax", "qf", "text"),
"*[count(//doc)=3]");
}
/**