Class BoostingQuery
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
Inheritance
System.Object
Lucene.Net.Search.Query
BoostingQuery
Inherited Members
Lucene.Net.Search.Query.Boost
Lucene.Net.Search.Query.ToString()
Lucene.Net.Search.Query.CreateWeight(Lucene.Net.Search.IndexSearcher)
Lucene.Net.Search.Query.Clone()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Lucene.Net.Queries.dll
Syntax
public class BoostingQuery : Query
Constructors
|
Improve this Doc
View Source
BoostingQuery(Query, Query, Single)
Declaration
public BoostingQuery(Query match, Query context, float boost)
Parameters
Type |
Name |
Description |
Lucene.Net.Search.Query |
match |
|
Lucene.Net.Search.Query |
context |
|
System.Single |
boost |
|
Methods
|
Improve this Doc
View Source
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Overrides
|
Improve this Doc
View Source
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
Overrides
Lucene.Net.Search.Query.GetHashCode()
|
Improve this Doc
View Source
Rewrite(IndexReader)
Declaration
public override Query Rewrite(IndexReader reader)
Parameters
Type |
Name |
Description |
Lucene.Net.Index.IndexReader |
reader |
|
Returns
Type |
Description |
Lucene.Net.Search.Query |
|
Overrides
Lucene.Net.Search.Query.Rewrite(Lucene.Net.Index.IndexReader)
|
Improve this Doc
View Source
ToString(String)
Declaration
public override string ToString(string field)
Parameters
Type |
Name |
Description |
System.String |
field |
|
Returns
Type |
Description |
System.String |
|
Overrides