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); }
internal AnonymousClassScorer(DocIdSetIterator docIdSetIterator, Lucene.Net.Search.Scorer scorer, AnonymousClassWeight enclosingInstance, Lucene.Net.Search.Similarity similarity) : base(similarity) { this.docIdSetIterator = docIdSetIterator; this.scorer = scorer; this.enclosingInstance = enclosingInstance; }
public virtual void TestSpanNearScorerSkipTo1() { SpanNearQuery q = MakeQuery(); Weight w = q.Weight(searcher); Scorer s = w.Scorer(searcher.GetIndexReader(), true, false); Assert.AreEqual(1, s.Advance(1)); }
/// <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); }
internal DrillSidewaysScorer(AtomicReaderContext context, Scorer baseScorer, Collector drillDownCollector, DocsAndCost[] dims, bool scoreSubDocsAtOnce) { this.dims = dims; this.context = context; this.baseScorer = baseScorer; this.drillDownCollector = drillDownCollector; this.scoreSubDocsAtOnce = scoreSubDocsAtOnce; }
public virtual void TestSpanNearScorerExplain() { SpanNearQuery q = MakeQuery(); Weight w = q.Weight(searcher); Scorer s = w.Scorer(searcher.GetIndexReader(), true, false); Explanation e = s.Explain(1); Assert.IsTrue(0.0f < e.GetValue(), "Scorer explanation value for doc#1 isn't positive: " + e.ToString()); }
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]; }
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.qWeight = w.Value; this.subQueryScorer = subQueryScorer; this.valSrcScorers = valSrcScorers; //this.reader = reader; this.vScores = new float[valSrcScorers.Length]; this.provider = this.Enclosing_Instance.GetCustomScoreProvider(reader); }
/*(non-Javadoc) @see Lucene.Net.Search.Weight#scorer(Lucene.Net.Index.IndexReader) */ public virtual Scorer Scorer(IndexReader reader) { Scorer subQueryScorer = subQueryWeight.Scorer(reader); Scorer[] valSrcScorers = new Scorer[valSrcWeights.Length]; for (int i = 0; i < valSrcScorers.Length; i++) { valSrcScorers[i] = valSrcWeights[i].Scorer(reader); } return(new CustomScorer(enclosingInstance, similarity, reader, this, subQueryScorer, valSrcScorers)); }
private void InitBlock(int[] order, int[] opidx, int skip_op, Lucene.Net.Search.Scorer scorer, int[] sdoc, float maxDiff, Lucene.Net.Search.Query q, Lucene.Net.Search.IndexSearcher s) { this.order = order; this.opidx = opidx; this.skip_op = skip_op; this.scorer = scorer; this.sdoc = sdoc; this.maxDiff = maxDiff; this.q = q; this.s = s; }
public virtual void TestSpanScorerZeroSloppyFreq() { bool ordered = true; int slop = 1; Similarity sim = new AnonymousClassDefaultSimilarity(this); SpanNearQuery snq = new AnonymousClassSpanNearQuery(sim, this, new SpanQuery[] { MakeSpanTermQuery("t1"), MakeSpanTermQuery("t2") }, slop, ordered); Scorer spanScorer = snq.Weight(searcher).Scorer(searcher.GetIndexReader(), true, false); Assert.IsTrue(spanScorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS, "first doc"); Assert.AreEqual(spanScorer.DocID(), 11, "first doc number"); float score = spanScorer.Score(); Assert.IsTrue(score == 0.0f, "first doc score should be zero, " + score); Assert.IsTrue(spanScorer.NextDoc() == DocIdSetIterator.NO_MORE_DOCS, "no second doc"); }
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 HeapedScorerDoc(ScorerDocQueue enclosingInstance, Scorer s) : this(enclosingInstance, s, s.DocID()) { }
internal HeapedScorerDoc(ScorerDocQueue enclosingInstance, Scorer scorer, int doc) { InitBlock(enclosingInstance); this.scorer = scorer; this.doc = doc; }
public override void SetScorer(Scorer scorer) { }
/// <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(); }
public AnonymousClassCollector(int[] order, int[] opidx, int skip_op, Lucene.Net.Search.Scorer scorer, int[] sdoc, float maxDiff, Lucene.Net.Search.Query q, Lucene.Net.Search.IndexSearcher s) { InitBlock(order, opidx, skip_op, scorer, sdoc, maxDiff, q, s); }
public override void SetScorer(Scorer scorer) { }
/*(non-Javadoc) @see Lucene.Net.Search.Weight#scorer(Lucene.Net.Index.IndexReader) */ public virtual Scorer Scorer(IndexReader reader) { Scorer subQueryScorer = subQueryWeight.Scorer(reader); Scorer[] valSrcScorers = new Scorer[valSrcWeights.Length]; for (int i = 0; i < valSrcScorers.Length; i++) { valSrcScorers[i] = valSrcWeights[i].Scorer(reader); } return new CustomScorer(enclosingInstance, similarity, reader, this, subQueryScorer, valSrcScorers); }
private void InitBlock(Lucene.Net.Search.Scorer scorer, Lucene.Net.Search.DocIdSetIterator docIdSetIterator, AnonymousClassWeight enclosingInstance) { this.scorer = scorer; this.docIdSetIterator = docIdSetIterator; this.enclosingInstance = enclosingInstance; }
//todo: value source public DoubleDocValuesAnonymousInnerClassHelper(ValueSourceAnonymousInnerClassHelper outerInstance, Scorer scorer) : base(null) { this.outerInstance = outerInstance; this.scorer = scorer; }
internal HeapedScorerDoc(ScorerDocQueue enclosingInstance, Scorer scorer, int doc) { InitBlock(enclosingInstance); this.scorer = scorer; this.doc = doc; }
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); }
internal AnonymousClassScorer(DocIdSetIterator docIdSetIterator, Lucene.Net.Search.Scorer scorer, AnonymousClassWeight enclosingInstance, Lucene.Net.Search.Similarity similarity) : base(similarity) { this.docIdSetIterator = docIdSetIterator; this.scorer = scorer; this.enclosingInstance = enclosingInstance; }
internal AnonymousClassScorer(Lucene.Net.Search.Scorer scorer, Lucene.Net.Search.DocIdSetIterator docIdSetIterator, AnonymousClassWeight enclosingInstance, Lucene.Net.Search.Similarity Param1) : base(Param1) { InitBlock(scorer, docIdSetIterator, enclosingInstance); }
/// <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; } } }
public override void SetScorer(Scorer scorer) { this.scorer = scorer; }
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 void SetScorer(Scorer scorer) { this.scorer = scorer; }
internal HeapedScorerDoc(ScorerDocQueue enclosingInstance, Scorer s) : this(enclosingInstance, s, s.DocID()) { }
internal AnonymousClassScorer(System.Collections.BitArray bitset, Lucene.Net.Search.Scorer scorer, AnonymousClassWeight enclosingInstance, Lucene.Net.Search.Similarity Param1) : base(Param1) { InitBlock(bitset, scorer, enclosingInstance); }
/// <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(); }
public override void SetScorer(Lucene.Net.Search.Scorer scorer) { }
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; }
private void InitBlock(Lucene.Net.Search.Scorer scorer, Lucene.Net.Search.DocIdSetIterator docIdSetIterator, AnonymousClassWeight enclosingInstance) { this.scorer = scorer; this.docIdSetIterator = docIdSetIterator; this.enclosingInstance = enclosingInstance; }
private void InitBlock(System.Collections.BitArray bitset, Lucene.Net.Search.Scorer scorer, AnonymousClassWeight enclosingInstance) { this.bitset = bitset; this.scorer = scorer; this.enclosingInstance = enclosingInstance; }
private void InitBlock(System.Collections.BitArray bitset, Lucene.Net.Search.Scorer scorer, AnonymousClassWeight enclosingInstance) { this.bitset = bitset; this.scorer = scorer; this.enclosingInstance = enclosingInstance; }