public virtual Explanation Explain(IndexReader ir, int i)
            {
                Explanation inner = weight.Explain(ir, i);

                if (Enclosing_Instance.GetBoost() != 1)
                {
                    Explanation preBoost = inner;
                    inner = new Explanation(inner.GetValue() * Enclosing_Instance.GetBoost(), "product of:");
                    inner.AddDetail(new Explanation(Enclosing_Instance.GetBoost(), "boost"));
                    inner.AddDetail(preBoost);
                }
                Filter           f = Enclosing_Instance.filter;
                DocIdSetIterator docIdSetIterator = f.GetDocIdSet(ir).Iterator();

                if (docIdSetIterator.SkipTo(i) && docIdSetIterator.Doc() == i)
                {
                    return(inner);
                }
                else
                {
                    Explanation result = new Explanation(0.0f, "failure to match filter: " + f.ToString());
                    result.AddDetail(inner);
                    return(result);
                }
            }
 private bool AdvanceToCommon()
 {
     while (scorer.Doc() != docIdSetIterator.Doc())
     {
         if (scorer.Doc() < docIdSetIterator.Doc())
         {
             if (!scorer.SkipTo(docIdSetIterator.Doc()))
             {
                 return(false);
             }
         }
         else if (!docIdSetIterator.SkipTo(scorer.Doc()))
         {
             return(false);
         }
     }
     return(true);
 }
Example #3
0
        // inherit javadoc
        public override void  Search(Weight weight, Filter filter, HitCollector results)
        {
            Scorer scorer = weight.Scorer(reader);

            if (scorer == null)
            {
                return;
            }

            if (filter == null)
            {
                scorer.Score(results);
                return;
            }

            DocIdSetIterator filterDocIdIterator = filter.GetDocIdSet(reader).Iterator(); // CHECKME: use ConjunctionScorer here?

            bool more = filterDocIdIterator.Next() && scorer.SkipTo(filterDocIdIterator.Doc());

            while (more)
            {
                int filterDocId = filterDocIdIterator.Doc();
                if (filterDocId > scorer.Doc() && !scorer.SkipTo(filterDocId))
                {
                    more = false;
                }
                else
                {
                    int scorerDocId = scorer.Doc();
                    if (scorerDocId == filterDocId) // permitted by filter
                    {
                        results.Collect(scorerDocId, scorer.Score());
                        more = filterDocIdIterator.Next();
                    }
                    else
                    {
                        more = filterDocIdIterator.SkipTo(scorerDocId);
                    }
                }
            }
        }
Example #4
0
 public override int Doc()
 {
     return(docIdSetIterator.Doc());
 }