org.apache.lucene.search

Class PrefixQuery

Implemented Interfaces:
Cloneable, java.io.Serializable

public class PrefixQuery
extends Query

A Query that matches documents containing terms with a specified prefix.
See Also:
Serialized Form

Constructor Summary

PrefixQuery(Term prefix)
Constructs a query for terms starting with prefix.

Method Summary

Query
combine(Query[] queries)
Expert: called when re-writing queries under MultiSearcher.
Term
getPrefix()
Returns the prefix of this query.
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

PrefixQuery

public PrefixQuery(Term prefix)
Constructs a query for terms starting with prefix.

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

getPrefix

public Term getPrefix()
Returns the prefix of this query.

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-2007 Apache Software Foundation. All Rights Reserved.