Exemple #1
0
 /// <summary>Scores and collects all matching documents.</summary>
 /// <param name="collector">The collector to which all matching documents are passed through.
 /// <br/>When this method is used the {@link #Explain(int)} method should not be used.
 /// </param>
 public override void  Score(Collector collector)
 {
     collector.SetScorer(this);
     while ((doc = countingSumScorer.NextDoc()) != NO_MORE_DOCS)
     {
         collector.Collect(doc);
     }
 }
Exemple #2
0
 public override int NextDoc()
 {
     if (reqScorer == null)
     {
         return(doc);
     }
     doc = reqScorer.NextDoc();
     if (doc == NO_MORE_DOCS)
     {
         reqScorer = null;                 // exhausted, nothing left
         return(doc);
     }
     if (exclDisi == null)
     {
         return(doc);
     }
     return(doc = ToNonExcluded());
 }
 /// <summary>Called the first time next() or skipTo() is called to
 /// initialize <code>scorerDocQueue</code>.
 /// </summary>
 private void  InitScorerDocQueue()
 {
     System.Collections.IEnumerator si = subScorers.GetEnumerator();
     scorerDocQueue = new ScorerDocQueue(nrScorers);
     while (si.MoveNext())
     {
         Scorer se = (Scorer)si.Current;
         if (se.NextDoc() != NO_MORE_DOCS)
         {
             // doc() method will be used in scorerDocQueue.
             scorerDocQueue.Insert(se);
         }
     }
 }
Exemple #4
0
        public /*internal*/ BooleanScorer(Similarity similarity, int minNrShouldMatch, System.Collections.IList optionalScorers, System.Collections.IList prohibitedScorers) : base(similarity)
        {
            InitBlock();
            this.minNrShouldMatch = minNrShouldMatch;

            if (optionalScorers != null && optionalScorers.Count > 0)
            {
                for (System.Collections.IEnumerator si = optionalScorers.GetEnumerator(); si.MoveNext();)
                {
                    Scorer scorer = (Scorer)si.Current;
                    maxCoord++;
                    if (scorer.NextDoc() != NO_MORE_DOCS)
                    {
                        scorers = new SubScorer(scorer, false, false, bucketTable.NewCollector(0), scorers);
                    }
                }
            }

            if (prohibitedScorers != null && prohibitedScorers.Count > 0)
            {
                for (System.Collections.IEnumerator si = prohibitedScorers.GetEnumerator(); si.MoveNext();)
                {
                    Scorer scorer = (Scorer)si.Current;
                    int    mask   = nextMask;
                    nextMask        = nextMask << 1;
                    prohibitedMask |= mask;                     // update prohibited mask
                    if (scorer.NextDoc() != NO_MORE_DOCS)
                    {
                        scorers = new SubScorer(scorer, false, true, bucketTable.NewCollector(mask), scorers);
                    }
                }
            }

            coordFactors = new float[maxCoord];
            Similarity sim = GetSimilarity();

            for (int i = 0; i < maxCoord; i++)
            {
                coordFactors[i] = sim.Coord(i, maxCoord - 1);
            }
        }
Exemple #5
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);
            }
Exemple #6
0
        public override int NextDoc()
        {
            bool more;

            do
            {
                while (bucketTable.first != null)
                {
                    // more queued
                    current           = bucketTable.first;
                    bucketTable.first = current.next;                     // pop the queue

                    // check prohibited & required, and minNrShouldMatch
                    if ((current.bits & prohibitedMask) == 0 && (current.bits & requiredMask) == requiredMask && current.coord >= minNrShouldMatch)
                    {
                        return(doc = current.doc);
                    }
                }

                // refill the queue
                more = false;
                end += BucketTable.SIZE;
                for (SubScorer sub = scorers; sub != null; sub = sub.next)
                {
                    Scorer scorer = sub.scorer;
                    sub.collector.SetScorer(scorer);
                    int doc = scorer.DocID();
                    while (doc < end)
                    {
                        sub.collector.Collect(doc);
                        doc = scorer.NextDoc();
                    }
                    more |= (doc != NO_MORE_DOCS);
                }
            }while (bucketTable.first != null || more);

            return(this.doc = NO_MORE_DOCS);
        }
Exemple #7
0
 public override int NextDoc()
 {
     return(reqScorer.NextDoc());
 }
Exemple #8
0
 public override bool Next()
 {
     return(scorer.NextDoc() != NO_MORE_DOCS);
 }