org.apache.lucene.queries

## Class BoostingQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.queries.BoostingQuery

- Deprecated.
  Use `FunctionScoreQuery.boostByQuery(Query, Query, float)`

      @Deprecated
      public class BoostingQuery
      extends Query

  The BoostingQuery class can be used to effectively demote results that match a given query. Unlike the "NOT" clause, this still selects documents that contain undesirable terms, but reduces their overall score: Query balancedQuery = new BoostingQuery(positiveQuery, negativeQuery, 0.01f); In this scenario the positiveQuery contains the mandatory, desirable criteria which is used to select all matching documents, and the negativeQuery contains the undesirable elements which are simply used to lessen the scores. Documents that match the negativeQuery have their score multiplied by the supplied "boost" parameter, so this should be less than 1 to achieve a demoting effect This code was originally made available here: http://marc.theaimsgroup.com/?l=lucene-user&m=108058407130459&w=2 and is documented here: http://wiki.apache.org/lucene-java/CommunityContributions

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BoostingQuery(Query match, Query context, float boost)` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Weight` | `createWeight(IndexSearcher searcher, boolean needsScores, float boost)` Deprecated.
    `boolean` | `equals(Object other)` Deprecated.
    `float` | `getBoost()` Deprecated.
    `Query` | `getContext()` Deprecated.
    `Query` | `getMatch()` Deprecated.
    `int` | `hashCode()` Deprecated.
    `Query` | `rewrite(IndexReader reader)` Deprecated.
    `String` | `toString(String field)` Deprecated.

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

      `classHash, sameClassAs, toString`

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

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

- - ### Constructor Detail

    - #### BoostingQuery

          public BoostingQuery(Query match,
                               Query context,
                               float boost)

      Deprecated.

  - ### Method Detail

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

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

    - #### createWeight

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

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

    - #### getMatch

          public Query getMatch()

      Deprecated.

    - #### getContext

          public Query getContext()

      Deprecated.

    - #### getBoost

          public float getBoost()

      Deprecated.

    - #### hashCode

          public int hashCode()

      Deprecated.
      Specified by:
        `hashCode` in class `Query`

    - #### equals

          public boolean equals(Object other)

      Deprecated.
      Specified by:
        `equals` in class `Query`

    - #### toString

          public String toString(String field)

      Deprecated.
      Specified by:
        `toString` in class `Query`

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