org.apache.solr.search

## Class SolrConstantScoreQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.solr.search.SolrConstantScoreQuery

- All Implemented Interfaces:
    ExtendedQuery
  Direct Known Subclasses:
    FunctionRangeQuery

      public class SolrConstantScoreQuery
      extends Query
      implements ExtendedQuery

  A query that wraps a filter and simply returns a constant score equal to the query boost for every document in the filter. This Solr extension also supports weighting of a SolrFilter. Experimental and subject to change.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `SolrConstantScoreQuery.ConstantWeight`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SolrConstantScoreQuery(Filter filter)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Weight` | `createWeight(IndexSearcher searcher, boolean needsScores)`
    `boolean` | `equals(Object other)` Returns true if `o` is equal to this.
    `boolean` | `getCache()` Should this query be cached in the query cache or filter cache.
    `boolean` | `getCacheSep()` If true, the clauses of this boolean query should be cached separately.
    `int` | `getCost()` Returns the cost of this query, used to order checking of filters that are not cached.
    `Filter` | `getFilter()` Returns the encapsulated filter
    `int` | `hashCode()` Returns a hash code value for this object.
    `void` | `setCache(boolean cache)`
    `void` | `setCacheSep(boolean cacheSep)`
    `void` | `setCost(int cost)`
    `String` | `toString(String field)` Prints a user-readable version of this query.

    - ### Methods inherited from class org.apache.lucene.search.Query

      `classHash, rewrite, sameClassAs, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SolrConstantScoreQuery

          public SolrConstantScoreQuery(Filter filter)

  - ### Method Detail

    - #### getFilter

          public Filter getFilter()

      Returns the encapsulated filter

    - #### setCache

          public void setCache(boolean cache)

      Specified by:
        `setCache` in interface `ExtendedQuery`

    - #### getCache

          public boolean getCache()

      Description copied from interface: `ExtendedQuery`
      Should this query be cached in the query cache or filter cache.
      Specified by:
        `getCache` in interface `ExtendedQuery`

    - #### setCacheSep

          public void setCacheSep(boolean cacheSep)

      Specified by:
        `setCacheSep` in interface `ExtendedQuery`

    - #### getCacheSep

          public boolean getCacheSep()

      Description copied from interface: `ExtendedQuery`
      If true, the clauses of this boolean query should be cached separately. This is not yet implemented.
      Specified by:
        `getCacheSep` in interface `ExtendedQuery`

    - #### setCost

          public void setCost(int cost)

      Specified by:
        `setCost` in interface `ExtendedQuery`

    - #### getCost

          public int getCost()

      Description copied from interface: `ExtendedQuery`
      Returns the cost of this query, used to order checking of filters that are not cached. If getCache()==false && getCost()>=100 && this instanceof PostFilter, then the PostFilter interface will be used for filtering.
      Specified by:
        `getCost` in interface `ExtendedQuery`

    - #### createWeight

          public Weight createWeight(IndexSearcher searcher,
                                     boolean needsScores)
                              throws IOException

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

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

      Returns true if `o` is equal to this.
      Specified by:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Returns a hash code value for this object.
      Specified by:
        `hashCode` in class `Query`

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