mirror of https://github.com/apache/lucene.git
LUCENE-7614: ComplexPhraseQueryParser ignores quotes around single terms phrases
This commit is contained in:
parent
024c4031e5
commit
52f2a77b78
|
@ -198,6 +198,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
|
||||
|
|
|
@ -255,7 +255,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
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
Loading…
Reference in New Issue