org.apache.lucene.search

Class MultiTermQuery

Implemented Interfaces:
Cloneable, java.io.Serializable
Known Direct Subclasses:
FuzzyQuery, 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

Query
combine(Query[] queries)
Expert: called when re-writing queries under MultiSearcher.
protected abstract FilteredTermEnum
getEnum(IndexReader reader)
Construct the enumeration to be used, expanding the pattern term.
Term
getTerm()
Returns the pattern term.
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, getBoost, getSimilarity, mergeBooleanQueries, rewrite, setBoost, toString, toString, weight

Constructor Details

MultiTermQuery

public MultiTermQuery(Term term)
Constructs a query for terms matching term.

Method Details

combine

public Query combine(Query[] queries)
Expert: called when re-writing queries under MultiSearcher.

Only implemented by derived queries, with no Query.createWeight(Searcher) implementatation.

Overrides:
combine in interface Query

getEnum

protected abstract FilteredTermEnum getEnum(IndexReader reader)
            throws IOException
Construct the enumeration to be used, expanding the pattern term.

getTerm

public Term getTerm()
Returns the pattern term.

rewrite

public Query rewrite(IndexReader reader)
            throws IOException
Expert: called to re-write queries into primitive queries.
Overrides:
rewrite in interface Query

toString

public String toString(String field)
Prints a user-readable version of this query.
Overrides:
toString in interface Query

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