public class NGramPhraseQuery extends Query
PhraseQuery which is optimized for n-gram phrase query.
For example, when you query "ABCD" on a 2-gram field, you may want to use
NGramPhraseQuery rather than PhraseQuery, because NGramPhraseQuery
will rewrite(IndexReader) the query to "AB/0 CD/2", while PhraseQuery
will query "AB/0 BC/1 CD/2" (where term/position).| Constructor and Description |
|---|
NGramPhraseQuery(int n,
PhraseQuery query)
Constructor that takes gram size.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
int[] |
getPositions()
Return the list of relative positions that each term should appear at.
|
Term[] |
getTerms()
Return the list of terms.
|
int |
hashCode() |
Query |
rewrite(IndexReader reader)
Expert: called to re-write queries into primitive queries.
|
String |
toString(String field)
Prints a query to a string, with
field assumed to be the
default field and omitted. |
public NGramPhraseQuery(int n,
PhraseQuery query)
n - n-gram sizepublic Query rewrite(IndexReader reader) throws IOException
Queryrewrite in class QueryIOExceptionpublic Term[] getTerms()
public int[] getPositions()
Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.