Lucene.Net  3.0.3
Lucene.Net is a port of the Lucene search engine library, written in C# and targeted at .NET runtime users.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Pages
Classes | Public Member Functions | List of all members
Lucene.Net.Search.Function.FieldScoreQuery Class Reference

A query that scores each document as the value of the numeric input field. The query matches all documents, and scores each document according to the numeric value of that field. It is assumed, and expected, that:

Combining this query in a FunctionQuery allows much freedom in affecting document scores. Note, that with this freedom comes responsibility: it is more than likely that the default Lucene scoring is superior in quality to scoring modified as explained here. However, in some cases, and certainly for research experiments, this capability may turn useful. When contructing this query, select the appropriate type. That type should match the data stored in the field. So in fact the "right" type should be selected before indexing. Type selection has effect on the RAM usage:

Caching: Values for the numeric field are loaded once and cached in memory for further use with the same IndexReader. To take advantage of this, it is extremely important to reuse index-readers or index-searchers, otherwise, for instance if for each query a new index reader is opened, large penalties would be paid for loading the field values into memory over and over again! More...

Inherits Lucene.Net.Search.Function.ValueSourceQuery.

Classes

class  Type
 Type of score field, indicating how field values are interpreted/parsed. The type selected at search search time should match the data stored in the field. Different types have different RAM requirements:

  • BYTE consumes 1 * maxDocs bytes.
  • SHORT consumes 2 * maxDocs bytes.
  • INT consumes 4 * maxDocs bytes.
  • FLOAT consumes 8 * maxDocs bytes.
More...
 

Public Member Functions

 FieldScoreQuery (System.String field, Type type)
 Create a FieldScoreQuery - a query that scores each document as the value of the numeric input field. The type param tells how to parse the field string values into a numeric score value.
 
- Public Member Functions inherited from Lucene.Net.Search.Function.ValueSourceQuery
 ValueSourceQuery (ValueSource valSrc)
 Create a value source query
 
override Query Rewrite (IndexReader reader)
 Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
 
override void ExtractTerms (System.Collections.Generic.ISet< Term > terms)
 Expert: adds all terms occuring in this query to the terms set. Only works if this query is in its rewritten form.
 
override Weight CreateWeight (Searcher searcher)
 Expert: Constructs an appropriate Weight implementation for this query.
 
override System.String ToString (System.String field)
 Prints a query to a string, with field assumed to be the default field and omitted. The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:

  • If the query was created by the parser, the printed representation may not be exactly what was parsed. For example, characters that need to be escaped will be represented without the required backslash.
  • Some of the more complicated queries (e.g. span queries) don't have a representation that can be parsed by QueryParser.

 
override bool Equals (System.Object o)
 Returns true if o is equal to this.
 
override int GetHashCode ()
 Returns a hash code value for this object.
 
override System.Object Clone ()
 Returns a clone of this query.
 
- Public Member Functions inherited from Lucene.Net.Search.Query
override System.String ToString ()
 Prints a query to a string.
 
virtual Weight Weight (Searcher searcher)
 Expert: Constructs and initializes a Weight for a top-level query.
 
virtual Query Combine (Query[] queries)
 Expert: called when re-writing queries under MultiSearcher.
 
virtual Similarity GetSimilarity (Searcher searcher)
 Expert: Returns the Similarity implementation to be used for this query. Subclasses may override this method to specify their own Similarity implementation, perhaps one that delegates through that of the Searcher. By default the Searcher's Similarity implementation is returned.
 
override int GetHashCode ()
 
override bool Equals (System.Object obj)
 

Additional Inherited Members

- Static Public Member Functions inherited from Lucene.Net.Search.Query
static Query MergeBooleanQueries (params BooleanQuery[] queries)
 Expert: merges the clauses of a set of BooleanQuery's into a single BooleanQuery.
 
- Properties inherited from Lucene.Net.Search.Query
virtual float Boost [get, set]
 Gets or sets the boost for this query clause to b. Documents matching this clause will (in addition to the normal weightings) have their score multiplied by b. The boost is 1.0 by default.
 

Detailed Description

A query that scores each document as the value of the numeric input field.

The query matches all documents, and scores each document according to the numeric value of that field.

It is assumed, and expected, that:

Combining this query in a FunctionQuery allows much freedom in affecting document scores. Note, that with this freedom comes responsibility: it is more than likely that the default Lucene scoring is superior in quality to scoring modified as explained here. However, in some cases, and certainly for research experiments, this capability may turn useful.

When contructing this query, select the appropriate type. That type should match the data stored in the field. So in fact the "right" type should be selected before indexing. Type selection has effect on the RAM usage:

Caching: Values for the numeric field are loaded once and cached in memory for further use with the same IndexReader. To take advantage of this, it is extremely important to reuse index-readers or index-searchers, otherwise, for instance if for each query a new index reader is opened, large penalties would be paid for loading the field values into memory over and over again!

<font color="#FF0000"> WARNING: The status of the Search.Function package is experimental. The APIs introduced here might change in the future and will not be supported anymore in such a case.</font>

Definition at line 63 of file FieldScoreQuery.cs.

Constructor & Destructor Documentation

Lucene.Net.Search.Function.FieldScoreQuery.FieldScoreQuery ( System.String  field,
Type  type 
)

Create a FieldScoreQuery - a query that scores each document as the value of the numeric input field. The type param tells how to parse the field string values into a numeric score value.

Parameters
fieldthe numeric field to be used.
typethe type of the field: either Type.BYTE, Type.SHORT, Type.INT, or Type.FLOAT.

Definition at line 113 of file FieldScoreQuery.cs.


The documentation for this class was generated from the following file: