## org.apache.lucene.search
Class ConstantScoreQuery

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

All Implemented Interfaces:
  Serializable, Cloneable

    public class ConstantScoreQuery

extends Query

A query that wraps a filter and simply returns a constant score equal to the query boost for every document in the filter.

Version:
  $Id: ConstantScoreQuery.java 564236 2007-08-09 15:21:19Z gsingers $
See Also:
  Serialized Form

Nested Class Summary
`protected class` `ConstantScoreQuery.ConstantScorer`
`protected class` `ConstantScoreQuery.ConstantWeight`

Field Summary
`protected Filter` `filter`

Constructor Summary
`ConstantScoreQuery(Filter filter)`

Method Summary
`protected Weight` `createWeight(Searcher searcher)` Expert: Constructs an appropriate Weight implementation for this query.
`boolean` `equals(Object o)` Returns true if `o` is equal to this.
`void` `extractTerms(Set terms)` Expert: adds all terms occuring in this query to the terms set.
`Filter` `getFilter()` Returns the encapsulated filter
`int` `hashCode()` Returns a hash code value for this object.
`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, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight`

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

Field Detail

### filter

    protected final Filter filter

Constructor Detail

### ConstantScoreQuery

    public ConstantScoreQuery(Filter filter)

Method Detail

### getFilter

    public Filter getFilter()

  Returns the encapsulated filter

### 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`

### 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`

### createWeight

    protected Weight createWeight(Searcher searcher)

  Description copied from class: `Query`
  Expert: Constructs an appropriate Weight implementation for this query.

  Only implemented by primitive queries, which re-write to themselves.

  Overrides:
    `createWeight` in class `Query`

### 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)

  Returns true if `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`

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