Class ConstantScoreQuery
A query that wraps another query or a filter and simply returns a constant score equal to the
query boost for every document that matches the filter or query.
For queries it therefore simply strips of all scores and returns a constant one.
Inheritance
ConstantScoreQuery
Assembly: Lucene.Net.dll
Syntax
public class ConstantScoreQuery : Query
Constructors
ConstantScoreQuery(Filter)
Wraps a Filter as a Query. The hits will get a constant score
dependent on the boost factor of this query.
If you simply want to strip off scores from a Query, no longer use
new ConstantScoreQuery(new QueryWrapperFilter(query))
, instead
use ConstantScoreQuery(Query)!
Declaration
public ConstantScoreQuery(Filter filter)
Parameters
Type |
Name |
Description |
Filter |
filter |
|
Exceptions
ConstantScoreQuery(Query)
Strips off scores from the passed in Query. The hits will get a constant score
dependent on the boost factor of this query.
Declaration
public ConstantScoreQuery(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Exceptions
Fields
m_filter
A query that wraps another query or a filter and simply returns a constant score equal to the
query boost for every document that matches the filter or query.
For queries it therefore simply strips of all scores and returns a constant one.
Declaration
protected readonly Filter m_filter
Field Value
m_query
A query that wraps another query or a filter and simply returns a constant score equal to the
query boost for every document that matches the filter or query.
For queries it therefore simply strips of all scores and returns a constant one.
Declaration
protected readonly Query m_query
Field Value
Properties
Filter
Returns the encapsulated filter, returns null
if a query is wrapped.
Declaration
public virtual Filter Filter { get; }
Property Value
Query
Returns the encapsulated query, returns null
if a filter is wrapped.
Declaration
public virtual Query Query { get; }
Property Value
Methods
CreateWeight(IndexSearcher)
Expert: Constructs an appropriate Weight implementation for this query.
Only implemented by primitive queries, which re-write to themselves.
Declaration
public override Weight CreateWeight(IndexSearcher searcher)
Parameters
Returns
Overrides
Equals(object)
Determines whether the specified object is equal to the current object.
Declaration
public override bool Equals(object o)
Parameters
Type |
Name |
Description |
object |
o |
|
Returns
Type |
Description |
bool |
true if the specified object is equal to the current object; otherwise, false.
|
Overrides
Expert: adds all terms occurring in this query to the terms set. Only
works if this query is in its rewritten (Rewrite(IndexReader)) form.
Declaration
public override void ExtractTerms(ISet<Term> terms)
Parameters
Overrides
Exceptions
GetHashCode()
Serves as the default hash function.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
int |
A hash code for the current object.
|
Overrides
Rewrite(IndexReader)
Declaration
public override Query Rewrite(IndexReader reader)
Parameters
Returns
Overrides
ToString(string)
Prints a query to a string, with field
assumed to be the
default field and omitted.
Declaration
public override string ToString(string field)
Parameters
Type |
Name |
Description |
string |
field |
|
Returns
Overrides