The DefaultSimilarity type exposes the following members.

Methods

  NameDescription
Public methodComputeNorm
Implemented as
CopyC#
state.getBoost()*lengthNorm(numTerms)
, where
CopyC#
numTerms
is {@link FieldInvertState#GetLength()} if {@link #setDiscountOverlaps} is false, else it's {@link FieldInvertState#GetLength()} - {@link FieldInvertState#GetNumOverlap()}.

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

(Overrides Similarity..::..ComputeNorm(String, FieldInvertState).)
Public methodCoord
Implemented as
CopyC#
overlap / maxOverlap
.
(Overrides Similarity..::..Coord(Int32, Int32).)
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetDiscountOverlaps
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodIdf(Int32, Int32)
Implemented as
CopyC#
log(numDocs/(docFreq+1)) + 1
.
(Overrides Similarity..::..Idf(Int32, Int32).)
Public methodIdf(ICollection, Searcher) Obsolete.
Computes a score factor for a phrase.

The default implementation sums the {@link #Idf(Term,Searcher)} factor for each term in the phrase.

(Inherited from Similarity.)
Public methodIdf(Term, Searcher) Obsolete.
Computes a score factor for a simple term.

The default implementation is:

            return idf(searcher.docFreq(term), searcher.maxDoc());
            
Note that {@link Searcher#MaxDoc()} is used instead of {@link Lucene.Net.Index.IndexReader#NumDocs()} because it is proportional to {@link Searcher#DocFreq(Term)} , i.e., when one is inaccurate, so is the other, and in the same direction.
(Inherited from Similarity.)
Public methodidfExplain
Computes a score factor for a phrase.

The default implementation sums the idf factor for each term in the phrase.

(Inherited from Similarity.)
Public methodIdfExplain
Computes a score factor for a simple term and returns an explanation for that score factor.

The default implementation uses:

            idf(searcher.docFreq(term), searcher.maxDoc());
            
Note that {@link Searcher#MaxDoc()} is used instead of {@link Lucene.Net.Index.IndexReader#NumDocs()} because it is proportional to {@link Searcher#DocFreq(Term)} , i.e., when one is inaccurate, so is the other, and in the same direction.
(Inherited from Similarity.)
Public methodLengthNorm
Implemented as
CopyC#
1/sqrt(numTerms)
.
(Overrides Similarity..::..LengthNorm(String, Int32).)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodQueryNorm
Implemented as
CopyC#
1/sqrt(sumOfSquaredWeights)
.
(Overrides Similarity..::..QueryNorm(Single).)
Public methodScorePayload(String, array<Byte>[]()[][], Int32, Int32) Obsolete.
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.

(Inherited from Similarity.)
Public methodScorePayload(Int32, String, Int32, Int32, array<Byte>[]()[][], Int32, Int32)
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.

(Inherited from Similarity.)
Public methodSetDiscountOverlaps
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.

Public methodSloppyFreq
Implemented as
CopyC#
1 / (distance + 1)
.
(Overrides Similarity..::..SloppyFreq(Int32).)
Public methodTf(Single)
Implemented as
CopyC#
sqrt(freq)
.
(Overrides Similarity..::..Tf(Single).)
Public methodTf(Int32)
Computes a score factor based on a term or phrase's frequency in a document. This value is multiplied by the {@link #Idf(Term, Searcher)} factor for each term in the query and these products are then summed to form the initial score for a document.

Terms and phrases repeated in a document indicate the topic of the document, so implementations of this method usually return larger values when

CopyC#
freq
is large, and smaller values when
CopyC#
freq
is small.

The default implementation calls {@link #Tf(float)}.

(Inherited from Similarity.)
Public methodToString
Returns a String that represents the current Object.
(Inherited from Object.)

See Also