19 using System.Collections.Generic;
20 using Lucene.Net.Documents;
22 using Term = Lucene.Net.Index.Term;
26 namespace Lucene.Net.Search
302 public AnonymousClassIDFExplanation1(
int df,
int max,
float idf,
Similarity enclosingInstance)
304 InitBlock(df, max, idf, enclosingInstance);
306 private void InitBlock(
int df,
int max,
float idf,
Similarity enclosingInstance)
311 this.enclosingInstance = enclosingInstance;
321 return enclosingInstance;
326 public override System.String Explain()
328 return "idf(docFreq=" + df +
", maxDocs=" + max +
")";
332 public override float Idf
340 public AnonymousClassIDFExplanation3(
float fIdf, System.Text.StringBuilder exp,
Similarity enclosingInstance)
342 InitBlock(fIdf, exp, enclosingInstance);
344 private void InitBlock(
float fIdf, System.Text.StringBuilder exp,
Similarity enclosingInstance)
348 this.enclosingInstance = enclosingInstance;
351 private System.Text.StringBuilder exp;
357 return enclosingInstance;
363 public override float Idf
369 public override System.String Explain()
371 return exp.ToString();
374 private void InitBlock()
381 public const int NO_DOC_ID_PROVIDED = - 1;
393 get {
return defaultImpl; }
394 set { defaultImpl = value; }
398 private static readonly
float[] NORM_TABLE =
new float[256];
403 public static float DecodeNorm(byte b)
405 return NORM_TABLE[b & 0xFF];
411 public static float[] GetNormDecoder()
439 return (
float) (state.Boost * LengthNorm(field, state.Length));
468 public abstract float LengthNorm(System.String fieldName,
int numTokens);
482 public abstract float QueryNorm(
float sumOfSquaredWeights);
498 public static byte EncodeNorm(
float f)
521 public virtual float Tf(
int freq)
523 return Tf((
float) freq);
539 public abstract float SloppyFreq(
int distance);
556 public abstract float Tf(
float freq);
584 int df = searcher.
DocFreq(term);
585 int max = searcher.
MaxDoc;
586 float idf2 = Idf(df, max);
587 return new AnonymousClassIDFExplanation1(df, max, idf2,
this);
608 int max = searcher.
MaxDoc;
610 System.Text.StringBuilder exp =
new System.Text.StringBuilder();
611 foreach (
Term term
in terms)
613 int df = searcher.DocFreq(term);
614 idf2 += Idf(df, max);
616 exp.Append(term.Text);
621 return new AnonymousClassIDFExplanation3(fIdf, exp,
this);
640 public abstract float Idf(
int docFreq,
int numDocs);
657 public abstract float Coord(
int overlap,
int maxOverlap);
684 public virtual float ScorePayload(
int docId, System.String fieldName,
int start,
int end, byte[] payload,
int offset,
int length)
692 for (
int i = 0; i < 256; i++)
693 NORM_TABLE[i] =
SmallFloat.Byte315ToFloat((byte) i);