## org.apache.lucene.search
Class MultiTermQuery

    java.lang.Object
      org.apache.lucene.search.Query
          org.apache.lucene.search.MultiTermQuery

All Implemented Interfaces:
  Serializable, Cloneable

Direct Known Subclasses:
  FuzzyQuery, RegexQuery, WildcardQuery

    public abstract class MultiTermQuery

extends Query

A `Query` that matches documents containing a subset of terms provided by a `FilteredTermEnum` enumeration.

`MultiTermQuery` is not designed to be used by itself.
The reason being that it is not intialized with a `FilteredTermEnum` enumeration. A `FilteredTermEnum` enumeration needs to be provided.

For example, `WildcardQuery` and `FuzzyQuery` extend `MultiTermQuery` to provide `WildcardTermEnum` and `FuzzyTermEnum`, respectively.

See Also:
  Serialized Form

Constructor Summary
`MultiTermQuery(Term term)` Constructs a query for terms matching `term`.

Method Summary
`boolean` `equals(Object o)`
`protected abstract FilteredTermEnum` `getEnum(IndexReader reader)` Construct the enumeration to be used, expanding the pattern term.
`Term` `getTerm()` Returns the pattern term.
`int` `hashCode()`
`Query` `rewrite(IndexReader reader)` Expert: called to re-write queries into primitive queries.
`String` `toString(String field)` Prints a user-readable version of this query.

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

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

Constructor Detail

### MultiTermQuery

    public MultiTermQuery(Term term)

  Constructs a query for terms matching `term`.

Method Detail

### getTerm

    public Term getTerm()

  Returns the pattern term.

### getEnum

    protected abstract FilteredTermEnum getEnum(IndexReader reader)
                                         throws IOException

  Construct the enumeration to be used, expanding the pattern term.

  Throws:
    `IOException`

### 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 `Query`
  Throws:
    `IOException`

### toString

    public String toString(String field)

  Prints a user-readable version of this query.

  Specified by:
    `toString` in class `Query`

### equals

    public boolean equals(Object o)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.