private Explanation DoExplain(IndexReader reader, int doc) { Scorer[] valSrcScorers = new Scorer[valSrcWeights.Length]; for (int i = 0; i < valSrcScorers.Length; i++) { valSrcScorers[i] = valSrcWeights[i].Scorer(reader, true, false); } Explanation subQueryExpl = subQueryWeight.Explain(reader, doc); if (!subQueryExpl.IsMatch()) { return(subQueryExpl); } // match Explanation[] valSrcExpls = new Explanation[valSrcScorers.Length]; for (int i = 0; i < valSrcScorers.Length; i++) { valSrcExpls[i] = valSrcScorers[i].Explain(doc); } Explanation customExp = Enclosing_Instance.GetCustomScoreProvider(reader).CustomExplain(doc, subQueryExpl, valSrcExpls); float sc = GetValue() * customExp.GetValue(); Explanation res = new ComplexExplanation(true, sc, Enclosing_Instance.ToString() + ", product of:"); res.AddDetail(customExp); res.AddDetail(new Explanation(GetValue(), "queryBoost")); // actually using the q boost as q weight (== weight value) return(res); }
/// <summary>Removes and returns the least scorer of the ScorerDocQueue in log(size) /// time. /// Should not be used when the queue is empty. /// </summary> public Scorer Pop() { // assert size > 0; Scorer result = topHSD.scorer; PopNoResult(); return(result); }
private float[] vScores; // reused in score() to avoid allocating this array for each doc // constructor internal CustomScorer(CustomScoreQuery enclosingInstance, Similarity similarity, IndexReader reader, CustomWeight w, Scorer subQueryScorer, Scorer[] valSrcScorers) : base(similarity) { InitBlock(enclosingInstance); this.weight = w; this.qWeight = w.GetValue(); this.subQueryScorer = subQueryScorer; this.valSrcScorers = valSrcScorers; this.reader = reader; this.vScores = new float[valSrcScorers.Length]; this.provider = this.Enclosing_Instance.GetCustomScoreProvider(reader); }
public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer) { // Pass true for "scoresDocsInOrder", because we // require in-order scoring, even if caller does not, // since we call advance on the valSrcScorers. Pass // false for "topScorer" because we will not invoke // score(Collector) on these scorers: Scorer subQueryScorer = subQueryWeight.Scorer(reader, true, false); if (subQueryScorer == null) { return(null); } Scorer[] valSrcScorers = new Scorer[valSrcWeights.Length]; for (int i = 0; i < valSrcScorers.Length; i++) { valSrcScorers[i] = valSrcWeights[i].Scorer(reader, true, topScorer); } return(new CustomScorer(enclosingInstance, similarity, reader, this, subQueryScorer, valSrcScorers)); }
/// <summary> Adds a Scorer to the ScorerDocQueue in log(size) time if either /// the ScorerDocQueue is not full, or not lessThan(scorer, top()). /// </summary> /// <param name="scorer"> /// </param> /// <returns> true if scorer is added, false otherwise. /// </returns> public virtual bool Insert(Scorer scorer) { if (size < maxSize) { Put(scorer); return(true); } else { int docNr = scorer.DocID(); if ((size > 0) && (!(docNr < topHSD.doc))) { // heap[1] is top() heap[1] = new HeapedScorerDoc(this, scorer, docNr); DownHeap(); return(true); } else { return(false); } } }
internal AnonymousClassScorer(Mono.Lucene.Net.Search.Scorer scorer, Mono.Lucene.Net.Search.DocIdSetIterator docIdSetIterator, AnonymousClassWeight enclosingInstance, Mono.Lucene.Net.Search.Similarity Param1) : base(Param1) { InitBlock(scorer, docIdSetIterator, enclosingInstance); }
private void InitBlock(Mono.Lucene.Net.Search.Scorer scorer, Mono.Lucene.Net.Search.DocIdSetIterator docIdSetIterator, AnonymousClassWeight enclosingInstance) { this.scorer = scorer; this.docIdSetIterator = docIdSetIterator; this.enclosingInstance = enclosingInstance; }
private float[] vScores; // reused in score() to avoid allocating this array for each doc // constructor internal CustomScorer(CustomScoreQuery enclosingInstance, Similarity similarity, IndexReader reader, CustomWeight w, Scorer subQueryScorer, Scorer[] valSrcScorers):base(similarity) { InitBlock(enclosingInstance); this.weight = w; this.qWeight = w.GetValue(); this.subQueryScorer = subQueryScorer; this.valSrcScorers = valSrcScorers; this.reader = reader; this.vScores = new float[valSrcScorers.Length]; this.provider = this.Enclosing_Instance.GetCustomScoreProvider(reader); }
private Explanation DoExplain(IndexReader reader, int doc) { Scorer[] valSrcScorers = new Scorer[valSrcWeights.Length]; for (int i = 0; i < valSrcScorers.Length; i++) { valSrcScorers[i] = valSrcWeights[i].Scorer(reader, true, false); } Explanation subQueryExpl = subQueryWeight.Explain(reader, doc); if (!subQueryExpl.IsMatch()) { return subQueryExpl; } // match Explanation[] valSrcExpls = new Explanation[valSrcScorers.Length]; for (int i = 0; i < valSrcScorers.Length; i++) { valSrcExpls[i] = valSrcScorers[i].Explain(doc); } Explanation customExp = Enclosing_Instance.GetCustomScoreProvider(reader).CustomExplain(doc, subQueryExpl, valSrcExpls); float sc = GetValue() * customExp.GetValue(); Explanation res = new ComplexExplanation(true, sc, Enclosing_Instance.ToString() + ", product of:"); res.AddDetail(customExp); res.AddDetail(new Explanation(GetValue(), "queryBoost")); // actually using the q boost as q weight (== weight value) return res; }
public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer) { // Pass true for "scoresDocsInOrder", because we // require in-order scoring, even if caller does not, // since we call advance on the valSrcScorers. Pass // false for "topScorer" because we will not invoke // score(Collector) on these scorers: Scorer subQueryScorer = subQueryWeight.Scorer(reader, true, false); if (subQueryScorer == null) { return null; } Scorer[] valSrcScorers = new Scorer[valSrcWeights.Length]; for (int i = 0; i < valSrcScorers.Length; i++) { valSrcScorers[i] = valSrcWeights[i].Scorer(reader, true, topScorer); } return new CustomScorer(enclosingInstance, similarity, reader, this, subQueryScorer, valSrcScorers); }
/// <summary> Adds a Scorer to a ScorerDocQueue in log(size) time. /// If one tries to add more Scorers than maxSize /// a RuntimeException (ArrayIndexOutOfBound) is thrown. /// </summary> public void Put(Scorer scorer) { size++; heap[size] = new HeapedScorerDoc(this, scorer); UpHeap(); }
internal HeapedScorerDoc(ScorerDocQueue enclosingInstance, Scorer scorer, int doc) { InitBlock(enclosingInstance); this.scorer = scorer; this.doc = doc; }
internal HeapedScorerDoc(ScorerDocQueue enclosingInstance, Scorer s) : this(enclosingInstance, s, s.DocID()) { }
/// <summary> Adds a Scorer to the ScorerDocQueue in log(size) time if either /// the ScorerDocQueue is not full, or not lessThan(scorer, top()). /// </summary> /// <param name="scorer"> /// </param> /// <returns> true if scorer is added, false otherwise. /// </returns> public virtual bool Insert(Scorer scorer) { if (size < maxSize) { Put(scorer); return true; } else { int docNr = scorer.DocID(); if ((size > 0) && (!(docNr < topHSD.doc))) { // heap[1] is top() heap[1] = new HeapedScorerDoc(this, scorer, docNr); DownHeap(); return true; } else { return false; } } }
internal HeapedScorerDoc(ScorerDocQueue enclosingInstance, Scorer s):this(enclosingInstance, s, s.DocID()) { }