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, toString
public NGramPhraseQuery(int n, PhraseQuery query)
n
- n-gram sizepublic Query rewrite(IndexReader reader) throws IOException
Query
rewrite
in class Query
IOException
public Term[] getTerms()
public int[] getPositions()
public float getBoost()
Query
b
. The boost is 1.0 by default.public void setBoost(float b)
Query
b
. Documents
matching this clause will (in addition to the normal weightings) have
their score multiplied by b
.Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.