public /*protected internal*/ virtual bool SetFreqCurrentDoc() { if (!more) { return(false); } doc = spans.Doc(); freq = 0.0f; do { int matchLength = spans.End() - spans.Start(); freq += Similarity.SloppyFreq(matchLength); more = spans.Next(); }while (more && (doc == spans.Doc())); return(true); }
public override bool LessThan(System.Object o1, System.Object o2) { Spans spans1 = (Spans)o1; Spans spans2 = (Spans)o2; if (spans1.Doc() == spans2.Doc()) { if (spans1.Start() == spans2.Start()) { return(spans1.End() < spans2.End()); } else { return(spans1.Start() < spans2.Start()); } } else { return(spans1.Doc() < spans2.Doc()); } }
protected internal override bool SetFreqCurrentDoc() { if (!More) { return(false); } Doc = Spans.Doc(); Freq_Renamed = 0.0f; NumMatches = 0; PayloadScore_Renamed = 0; PayloadsSeen = 0; while (More && Doc == Spans.Doc()) { int matchLength = Spans.End() - Spans.Start(); Freq_Renamed += DocScorer.ComputeSlopFactor(matchLength); NumMatches++; ProcessPayload(OuterInstance.Similarity); More = Spans.Next(); // this moves positions to the next match in this // document } return(More || (Freq_Renamed != 0)); }
protected internal virtual void ProcessPayload(Similarity similarity) { if (TermSpans.PayloadAvailable) { DocsAndPositionsEnum postings = TermSpans.Postings; Payload = postings.Payload; if (Payload != null) { PayloadScore_Renamed = OuterInstance.OuterInstance.Function.CurrentScore(Doc, OuterInstance.OuterInstance.Term.Field, Spans.Start(), Spans.End(), PayloadsSeen, PayloadScore_Renamed, DocScorer.ComputePayloadFactor(Doc, Spans.Start(), Spans.End(), Payload)); } else { PayloadScore_Renamed = OuterInstance.OuterInstance.Function.CurrentScore(Doc, OuterInstance.OuterInstance.Term.Field, Spans.Start(), Spans.End(), PayloadsSeen, PayloadScore_Renamed, 1F); } PayloadsSeen++; } else { // zero out the payload? } }
public virtual int End() { return(spans.End()); }