org.apache.lucene.search

## Class BoostingQuery

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

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable

      public class BoostingQuery
      extends org.apache.lucene.search.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: [WWW] http://marc.theaimsgroup.com/?l=lucene-user&m=108058407130459&w=2 and is documented here: http://wiki.apache.org/lucene-java/CommunityContributions
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BoostingQuery(org.apache.lucene.search.Query match, org.apache.lucene.search.Query context, float boost)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `int` | `hashCode()`
    `org.apache.lucene.search.Query` | `rewrite(org.apache.lucene.index.IndexReader reader)`
    `java.lang.String` | `toString(java.lang.String field)`

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

      `clone, combine, createWeight, extractTerms, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight`

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

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

- - ### Constructor Detail

    - #### BoostingQuery

          public BoostingQuery(org.apache.lucene.search.Query match,
                               org.apache.lucene.search.Query context,
                               float boost)

  - ### Method Detail

    - #### rewrite

          public org.apache.lucene.search.Query rewrite(org.apache.lucene.index.IndexReader reader)
                                                 throws java.io.IOException

      Overrides:
        `rewrite` in class `org.apache.lucene.search.Query`
      Throws:
        `java.io.IOException`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `org.apache.lucene.search.Query`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `org.apache.lucene.search.Query`

    - #### toString

          public java.lang.String toString(java.lang.String field)

      Specified by:
        `toString` in class `org.apache.lucene.search.Query`

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