Package org.apache.lucene.search
Class NGramPhraseQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.lucene.search.PhraseQuery
-
- org.apache.lucene.search.NGramPhraseQuery
-
- All Implemented Interfaces:
java.lang.Cloneable
public class NGramPhraseQuery extends PhraseQuery
This is aPhraseQuerywhich 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 thanPhraseQuery, because NGramPhraseQuery willrewrite(IndexReader)the query to "AB/0 CD/2", whilePhraseQuerywill query "AB/0 BC/1 CD/2" (where term/position).
-
-
Constructor Summary
Constructors Constructor Description NGramPhraseQuery(int n)Constructor that takes gram size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Returns true iffois equal to this.inthashCode()Returns a hash code value for this object.Queryrewrite(IndexReader reader)Expert: called to re-write queries into primitive queries.-
Methods inherited from class org.apache.lucene.search.PhraseQuery
add, add, createWeight, extractTerms, getPositions, getSlop, getTerms, setSlop, toString
-
-
-
-
Method Detail
-
rewrite
public Query rewrite(IndexReader reader) throws java.io.IOException
Description copied from class:QueryExpert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.- Overrides:
rewritein classPhraseQuery- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object o)
Returns true iffois equal to this.- Overrides:
equalsin classPhraseQuery
-
hashCode
public int hashCode()
Returns a hash code value for this object.- Overrides:
hashCodein classPhraseQuery
-
-