Lucene.Net  3.0.3
Lucene.Net is a .NET port of the Java Lucene Indexing Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties
Public Member Functions | Properties | List of all members
Lucene.Net.Search.DefaultSimilarity Class Reference

Expert: Default scoring implementation. More...

Inherits Lucene.Net.Search.Similarity.

Inherited by Lucene.Net.Search.BoostingQuery.AnonymousDefaultSimilarity.

Public Member Functions

override float ComputeNorm (System.String field, FieldInvertState state)
 Implemented as state.getBoost()*lengthNorm(numTerms), where numTerms is FieldInvertState.Length if DiscountOverlaps is false, else it's FieldInvertState.Length
 
override float LengthNorm (System.String fieldName, int numTerms)
 Implemented as 1/sqrt(numTerms).
 
override float QueryNorm (float sumOfSquaredWeights)
 Implemented as 1/sqrt(sumOfSquaredWeights).
 
override float Tf (float freq)
 Implemented as sqrt(freq).
 
override float SloppyFreq (int distance)
 Implemented as 1 / (distance + 1).
 
override float Idf (int docFreq, int numDocs)
 Implemented as log(numDocs/(docFreq+1)) + 1.
 
override float Coord (int overlap, int maxOverlap)
 Implemented as overlap / maxOverlap.
 
- Public Member Functions inherited from Lucene.Net.Search.Similarity
virtual float Tf (int freq)
 Computes a score factor based on a term or phrase's frequency in a document. This value is multiplied by the Idf(int, int) factor for each term in the query and these products are then summed to form the initial score for a document.
 
virtual IDFExplanation IdfExplain (Term term, Searcher searcher)
 Computes a score factor for a simple term and returns an explanation for that score factor.
 
virtual IDFExplanation IdfExplain (ICollection< Term > terms, Searcher searcher)
 Computes a score factor for a phrase.
 
virtual float ScorePayload (int docId, System.String fieldName, int start, int end, byte[] payload, int offset, int length)
 Calculate a scoring factor based on the data in the payload. Overriding implementations are responsible for interpreting what is in the payload. Lucene makes no assumptions about what is in the byte array. The default implementation returns 1.
 

Properties

virtual bool DiscountOverlaps [get, set]
 Determines whether overlap tokens (Tokens with 0 position increment) are ignored when computing norm. By default this is false, meaning overlap tokens are counted just like non-overlap tokens.
 
- Properties inherited from Lucene.Net.Search.Similarity
static Similarity Default [get, set]
 Gets or sets the default Similarity implementation used by indexing and search code. This is initially an instance of DefaultSimilarity.
 

Additional Inherited Members

- Static Public Member Functions inherited from Lucene.Net.Search.Similarity
static float DecodeNorm (byte b)
 Decodes a normalization factor stored in an index.
 
static float[] GetNormDecoder ()
 Returns a table for decoding normalization bytes.
 
static byte EncodeNorm (float f)
 Encodes a normalization factor for storage in an index.
 
- Public Attributes inherited from Lucene.Net.Search.Similarity
const int NO_DOC_ID_PROVIDED = - 1
 
- Protected Member Functions inherited from Lucene.Net.Search.Similarity
 Similarity ()
 

Detailed Description

Expert: Default scoring implementation.

Definition at line 27 of file DefaultSimilarity.cs.

Member Function Documentation

override float Lucene.Net.Search.DefaultSimilarity.ComputeNorm ( System.String  field,
FieldInvertState  state 
)
virtual

Implemented as state.getBoost()*lengthNorm(numTerms), where numTerms is FieldInvertState.Length if DiscountOverlaps is false, else it's FieldInvertState.Length

  • FieldInvertState.NumOverlap

WARNING: This API is new and experimental, and may suddenly change.

Reimplemented from Lucene.Net.Search.Similarity.

Definition at line 40 of file DefaultSimilarity.cs.

override float Lucene.Net.Search.DefaultSimilarity.Coord ( int  overlap,
int  maxOverlap 
)
virtual

Implemented as overlap / maxOverlap.

Implements Lucene.Net.Search.Similarity.

Definition at line 81 of file DefaultSimilarity.cs.

override float Lucene.Net.Search.DefaultSimilarity.Idf ( int  docFreq,
int  numDocs 
)
virtual

Implemented as log(numDocs/(docFreq+1)) + 1.

Implements Lucene.Net.Search.Similarity.

Definition at line 75 of file DefaultSimilarity.cs.

override float Lucene.Net.Search.DefaultSimilarity.LengthNorm ( System.String  fieldName,
int  numTerms 
)
virtual

Implemented as 1/sqrt(numTerms).

Implements Lucene.Net.Search.Similarity.

Definition at line 51 of file DefaultSimilarity.cs.

override float Lucene.Net.Search.DefaultSimilarity.QueryNorm ( float  sumOfSquaredWeights)
virtual

Implemented as 1/sqrt(sumOfSquaredWeights).

Implements Lucene.Net.Search.Similarity.

Definition at line 57 of file DefaultSimilarity.cs.

override float Lucene.Net.Search.DefaultSimilarity.SloppyFreq ( int  distance)
virtual

Implemented as 1 / (distance + 1).

Implements Lucene.Net.Search.Similarity.

Definition at line 69 of file DefaultSimilarity.cs.

override float Lucene.Net.Search.DefaultSimilarity.Tf ( float  freq)
virtual

Implemented as sqrt(freq).

Implements Lucene.Net.Search.Similarity.

Definition at line 63 of file DefaultSimilarity.cs.

Property Documentation

virtual bool Lucene.Net.Search.DefaultSimilarity.DiscountOverlaps
getset

Determines whether overlap tokens (Tokens with 0 position increment) are ignored when computing norm. By default this is false, meaning overlap tokens are counted just like non-overlap tokens.

WARNING: This API is new and experimental, and may suddenly change.

See Also
ComputeNorm

Definition at line 103 of file DefaultSimilarity.cs.


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