org.apache.lucene.search

Class FilteredQuery

public class FilteredQuery extends Query

A query that applies a filter to the results of another query.

Note: the bits are retrieved from the filter each time this query is used in a search - use a CachingWrapperFilter to avoid regenerating the bits every time.

Created: Apr 20, 2004 8:58:29 AM

Since: 1.4

Version: $Id: FilteredQuery.java 544254 2007-06-04 20:41:06Z doronc $

Author: Tim Jones

See Also: CachingWrapperFilter

Constructor Summary
FilteredQuery(Query query, Filter filter)
Constructs a new query which applies a filter to the results of the original query.
Method Summary
protected WeightcreateWeight(Searcher searcher)
Returns a Weight that applies the filter to the enclosed query's Weight.
booleanequals(Object o)
Returns true iff o is equal to this.
voidextractTerms(Set terms)
FiltergetFilter()
QuerygetQuery()
inthashCode()
Returns a hash code value for this object.
Queryrewrite(IndexReader reader)
Rewrites the wrapped query.
StringtoString(String s)
Prints a user-readable version of this query.

Constructor Detail

FilteredQuery

public FilteredQuery(Query query, Filter filter)
Constructs a new query which applies a filter to the results of the original query. Filter.bits() will be called every time this query is used in a search.

Parameters: query Query to be filtered, cannot be null. filter Filter to apply to query results, cannot be null.

Method Detail

createWeight

protected Weight createWeight(Searcher searcher)
Returns a Weight that applies the filter to the enclosed query's Weight. This is accomplished by overriding the Scorer returned by the Weight.

equals

public boolean equals(Object o)
Returns true iff o is equal to this.

extractTerms

public void extractTerms(Set terms)

getFilter

public Filter getFilter()

getQuery

public Query getQuery()

hashCode

public int hashCode()
Returns a hash code value for this object.

rewrite

public Query rewrite(IndexReader reader)
Rewrites the wrapped query.

toString

public String toString(String s)
Prints a user-readable version of this query.
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.