The Scorer for DisjunctionMaxQuery's. The union of all documents generated by the the subquery scorers is generated in document number order. The score for each document is the maximum of the scores computed by the subquery scorers that generate that document, plus tieBreakerMultiplier times the sum of the scores for the other subqueries that generate the document.
Inheritance: Lucene.Net.Search.Scorer
示例#1
0
            /* Create the scorer used to score our associated DisjunctionMaxQuery */
            public virtual Scorer Scorer(IndexReader reader)
            {
                DisjunctionMaxScorer result = new DisjunctionMaxScorer(Enclosing_Instance.tieBreakerMultiplier, similarity);

                for (int i = 0; i < weights.Count; i++)
                {
                    Weight w         = (Weight)weights[i];
                    Scorer subScorer = w.Scorer(reader);
                    if (subScorer == null)
                    {
                        return(null);
                    }
                    result.Add(subScorer);
                }
                return(result);
            }
示例#2
0
            /* Create the scorer used to score our associated DisjunctionMaxQuery */
            public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer, IState state)
            {
                Scorer[] scorers = new Scorer[weights.Count];
                int      idx     = 0;

                foreach (Weight w in weights)
                {
                    Scorer subScorer = w.Scorer(reader, true, false, state);
                    if (subScorer != null && subScorer.NextDoc(state) != DocIdSetIterator.NO_MORE_DOCS)
                    {
                        scorers[idx++] = subScorer;
                    }
                }
                if (idx == 0)
                {
                    return(null);                    // all scorers did not have documents
                }
                DisjunctionMaxScorer result = new DisjunctionMaxScorer(Enclosing_Instance.tieBreakerMultiplier, similarity, scorers, idx);

                return(result);
            }
示例#3
0
            /// <summary>
            /// Create the scorer used to score our associated <see cref="DisjunctionMaxQuery"/> </summary>
            public override Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs)
            {
                IList <Scorer> scorers = new List <Scorer>();

                foreach (Weight w in m_weights)
                {
                    // we will advance() subscorers
                    Scorer subScorer = w.GetScorer(context, acceptDocs);
                    if (subScorer != null)
                    {
                        scorers.Add(subScorer);
                    }
                }
                if (scorers.Count == 0)
                {
                    // no sub-scorers had any documents
                    return(null);
                }
                DisjunctionMaxScorer result = new DisjunctionMaxScorer(this, outerInstance.tieBreakerMultiplier, scorers.ToArray());

                return(result);
            }
示例#4
0
            /* Create the scorer used to score our associated DisjunctionMaxQuery */
            public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer)
            {
                Scorer[] scorers = new Scorer[weights.Count];
                int      idx     = 0;

                for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext();)
                {
                    Weight w         = (Weight)iter.Current;
                    Scorer subScorer = w.Scorer(reader, true, false);
                    if (subScorer != null && subScorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS)
                    {
                        scorers[idx++] = subScorer;
                    }
                }
                if (idx == 0)
                {
                    return(null);                    // all scorers did not have documents
                }
                DisjunctionMaxScorer result = new DisjunctionMaxScorer(Enclosing_Instance.tieBreakerMultiplier, similarity, scorers, idx);

                return(result);
            }
 /* Create the scorer used to score our associated DisjunctionMaxQuery */
 public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer)
 {
     Scorer[] scorers = new Scorer[weights.Count];
     int idx = 0;
     for (System.Collections.IEnumerator iter = weights.GetEnumerator(); iter.MoveNext(); )
     {
         Weight w = (Weight) iter.Current;
         Scorer subScorer = w.Scorer(reader, true, false);
         if (subScorer != null && subScorer.NextDoc() != DocIdSetIterator.NO_MORE_DOCS)
         {
             scorers[idx++] = subScorer;
         }
     }
     if (idx == 0)
         return null; // all scorers did not have documents
     DisjunctionMaxScorer result = new DisjunctionMaxScorer(Enclosing_Instance.tieBreakerMultiplier, similarity, scorers, idx);
     return result;
 }
示例#6
0
			/* Create the scorer used to score our associated DisjunctionMaxQuery */
			public virtual Scorer Scorer(IndexReader reader)
			{
				DisjunctionMaxScorer result = new DisjunctionMaxScorer(Enclosing_Instance.tieBreakerMultiplier, Enclosing_Instance.GetSimilarity(searcher));
				for (int i = 0; i < weights.Count; i++)
				{
					Weight w = (Weight) weights[i];
					Scorer subScorer = w.Scorer(reader);
					if (subScorer == null)
						return null;
					result.Add(subScorer);
				}
				return result;
			}