Computes the normalization value for a field given the total number of terms contained in a field. These values, together with field boosts, are stored in an index and multipled into scores for hits on each field by the search code.

Matches in longer fields are less precise, so implementations of this method usually return smaller values when

CopyC#
numTokens
is large, and larger values when
CopyC#
numTokens
is small.

Note that the return values are computed under {@link Lucene.Net.Index.IndexWriter#AddDocument(Lucene.Net.Documents.Document)} and then stored using {@link #EncodeNorm(float)}. Thus they have limited precision, and documents must be re-indexed if this method is altered.

Namespace: Lucene.Net.Search
Assembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1

Syntax

C#
public abstract float LengthNorm(
	string fieldName,
	int numTokens
)
Visual Basic
Public MustOverride Function LengthNorm ( _
	fieldName As String, _
	numTokens As Integer _
) As Single
Visual C++
public:
virtual float LengthNorm(
	String^ fieldName, 
	int numTokens
) abstract

Parameters

fieldName
Type: System..::..String
the name of the field
numTokens
Type: System..::..Int32
the total number of tokens contained in fields named fieldName of doc.

Return Value

a normalization factor for hits on this field of this document

See Also

[!:Lucene.Net.Documents.Field.SetBoost(float)]