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) |
float |
getBoost()
Gets the boost for this clause.
|
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.
|
void |
setBoost(float b)
Sets the boost for this query clause to
b. |
String |
toString(String field)
Prints a query to a string, with
field assumed to be the
default field and omitted. |
clone, createWeight, toStringpublic NGramPhraseQuery(int n,
PhraseQuery query)
n - n-gram sizepublic Query rewrite(IndexReader reader) throws IOException
Queryrewrite in class QueryIOExceptionpublic Term[] getTerms()
public int[] getPositions()
public float getBoost()
Queryb. The boost is 1.0 by default.public void setBoost(float b)
Queryb. Documents
matching this clause will (in addition to the normal weightings) have
their score multiplied by b.Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.