Class NGramPhraseQuery
This is a 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).
Collection initializer note: To create and populate a PhraseQuery in a single statement, you can use the following example as a guide:
var phraseQuery = new NGramPhraseQuery(2) {
new Term("field", "ABCD"),
new Term("field", "EFGH")
};
Note that as long as you specify all of the parameters, you can use either Add(Term) or Add(Term, Int32) as the method to use to initialize. If there are multiple parameters, each parameter set must be surrounded by curly braces.
Inherited Members
Assembly: DistributedLucene.Net.dll
Syntax
public class NGramPhraseQuery : PhraseQuery, IEnumerable<Term>
Constructors
Name | Description |
---|---|
NGramPhraseQuery(Int32) | Constructor that takes gram size. |
Methods
Name | Description |
---|---|
Equals(Object) | Returns |
GetHashCode() | Returns a hash code value for this object. |
Rewrite(IndexReader) |