You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mk...@apache.org on 2017/01/07 06:39:37 UTC
lucene-solr:branch_6x: LUCENE-7614: ComplexPhraseQueryParser ignores
quotes around single terms phrases
Repository: lucene-solr
Updated Branches:
refs/heads/branch_6x 88450c70b -> ac85a41cb
LUCENE-7614: ComplexPhraseQueryParser ignores quotes around single terms phrases
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ac85a41c
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ac85a41c
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ac85a41c
Branch: refs/heads/branch_6x
Commit: ac85a41cbefa7b0ea8c1b0b5c3ec9584d318a1cb
Parents: 88450c7
Author: Mikhail Khludnev <mk...@apache.org>
Authored: Thu Jan 5 23:39:46 2017 +0300
Committer: Mikhail Khludnev <mk...@apache.org>
Committed: Sat Jan 7 09:19:33 2017 +0300
----------------------------------------------------------------------
lucene/CHANGES.txt | 3 +++
.../queryparser/complexPhrase/ComplexPhraseQueryParser.java | 4 +++-
.../queryparser/complexPhrase/TestComplexPhraseQuery.java | 6 ++++++
3 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ac85a41c/lucene/CHANGES.txt
----------------------------------------------------------------------
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 9ffa879..0454a4f 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -145,6 +145,9 @@ Improvements
* LUCENE-7401: Changed the way BKD trees pick the split dimension in order to
ensure all dimensions are indexed. (Adrien Grand)
+* LUCENE-7614: Complex Phrase Query parser ignores double quotes around single token
+ prefix, wildcard, range queries (Mikhail Khludnev)
+
Optimizations
* LUCENE-7568: Optimize merging when index sorting is used but the
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ac85a41c/lucene/queryparser/src/java/org/apache/lucene/queryparser/complexPhrase/ComplexPhraseQueryParser.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/complexPhrase/ComplexPhraseQueryParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/complexPhrase/ComplexPhraseQueryParser.java
index ac808d7..503bfda 100644
--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/complexPhrase/ComplexPhraseQueryParser.java
+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/complexPhrase/ComplexPhraseQueryParser.java
@@ -254,7 +254,9 @@ public class ComplexPhraseQueryParser extends QueryParser {
public Query rewrite(IndexReader reader) throws IOException {
final Query contents = this.contents[0];
// ArrayList spanClauses = new ArrayList();
- if (contents instanceof TermQuery) {
+ if (contents instanceof TermQuery
+ || contents instanceof MultiTermQuery
+ ) {
return contents;
}
// Build a sequence of Span clauses arranged in a SpanNear - child
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ac85a41c/lucene/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java
----------------------------------------------------------------------
diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java
index 66078b0..28b600b 100644
--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java
+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/complexPhrase/TestComplexPhraseQuery.java
@@ -72,6 +72,12 @@ public class TestComplexPhraseQuery extends LuceneTestCase {
checkBadQuery("\"jo* \"smith\" \""); // phrases inside phrases is bad
}
+ public void testSingleTermPhrase() throws Exception {
+ checkMatches("\"joh*\" \"tom\"", "1,2,3,4");
+ checkMatches("+\"j*\" +\"tom\"", "4");
+ checkMatches("\"jo*\" \"[sma TO smZ]\" ", "1,2,3");
+ checkMatches("+\"j*hn\" +\"sm*h\"", "1,3");
+ }
public void testUnOrderedProximitySearches() throws Exception {