Serializable, Cloneablepublic class NGramPhraseQuery extends PhraseQuery
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 | Description |
|---|---|
NGramPhraseQuery(int n) |
Constructor that takes gram size.
|
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals(Object o) |
Returns true iff
o is equal to this. |
int |
hashCode() |
Returns a hash code value for this object.
|
Query |
rewrite(IndexReader reader) |
Expert: called to re-write queries into primitive queries.
|
finalize, getClass, notify, notifyAll, wait, wait, waitadd, add, createWeight, extractTerms, getPositions, getSlop, getTerms, setSlop, toStringclone, combine, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weightpublic NGramPhraseQuery(int n)
n - public Query rewrite(IndexReader reader) throws IOException
Queryrewrite in class PhraseQueryIOExceptionpublic boolean equals(Object o)
o is equal to this.equals in class PhraseQuerypublic int hashCode()
hashCode in class PhraseQueryCopyright © 2000-2018 Apache Software Foundation. All Rights Reserved.