NGramPhraseQuery (Lucene 3.6.2 API)
Keywords: org.apache.lucene.search.NGramPhraseQuery class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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:
  Serializable, Cloneable

    public class NGramPhraseQuery

extends PhraseQuery

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).

See Also:
  Serialized Form

Constructor Summary
`NGramPhraseQuery(int n)` Constructor that takes gram size.

Method Summary
`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.

Methods inherited from class org.apache.lucene.search.PhraseQuery
`add, add, createWeight, extractTerms, getPositions, getSlop, getTerms, setSlop, toString`

Methods inherited from class org.apache.lucene.search.Query
`clone, combine, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight`

Methods inherited from class java.lang.Object
`finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NGramPhraseQuery

    public NGramPhraseQuery(int n)

  Constructor that takes gram size.

  Parameters:
    `n` -

Method Detail

### rewrite

    public Query rewrite(IndexReader reader)
                  throws IOException

  Description copied from class: `Query`
  Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.

  Overrides:
    `rewrite` in class `PhraseQuery`
  Throws:
    `IOException`

### equals

    public boolean equals(Object o)

  Returns true iff `o` is equal to this.

  Overrides:
    `equals` in class `PhraseQuery`

### hashCode

    public int hashCode()

  Returns a hash code value for this object.

  Overrides:
    `hashCode` in class `PhraseQuery`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD