FilteredQuery (Lucene 2.4.1 API)
Keywords: org.apache.lucene.search.FilteredQuery 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 FilteredQuery

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

All Implemented Interfaces:
  Serializable, Cloneable

    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 695514 2008-09-15 15:42:11Z otis $
See Also:
  `CachingWrapperFilter`, Serialized Form

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 Weight` | `createWeight(Searcher searcher)` Returns a Weight that applies the filter to the enclosed query's Weight.
`boolean` | `equals(Object o)` Returns true iff `o` is equal to this.
`void` | `extractTerms(Set terms)` Expert: adds all terms occuring in this query to the terms set.
`Filter` | `getFilter()`
`Query` | `getQuery()`
`int` | `hashCode()` Returns a hash code value for this object.
`Query` | `rewrite(IndexReader reader)` Rewrites the wrapped query.
`String` | `toString(String s)` Prints a user-readable version of this query.

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

### FilteredQuery

    public FilteredQuery(Query query,
                         Filter filter)

  Constructs a new query which applies a filter to the results of the original query. Filter.getDocIdSet() 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)
                           throws IOException

  Returns a Weight that applies the filter to the enclosed query's Weight. This is accomplished by overriding the Scorer returned by the Weight.

  Overrides:
    `createWeight` in class `Query`
  Throws:
    `IOException`

### rewrite

    public Query rewrite(IndexReader reader)
                  throws IOException

  Rewrites the wrapped query.

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

### getQuery

    public Query getQuery()

### getFilter

    public Filter getFilter()

### extractTerms

    public void extractTerms(Set terms)

  Description copied from class: `Query`
  Expert: adds all terms occuring in this query to the terms set. Only works if this query is in its `rewritten` form.

  Overrides:
    `extractTerms` in class `Query`

### toString

    public String toString(String s)

  Prints a user-readable version of this query.

  Specified by:
    `toString` in class `Query`

### equals

    public boolean equals(Object o)

  Returns true iff `o` is equal to this.

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Returns a hash code value for this object.

  Overrides:
    `hashCode` in class `Object`

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

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