Ejemplo n.º 1
0
            public override 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;
                DocIdSet         docIdSet         = f.GetDocIdSet(ir);
                DocIdSetIterator docIdSetIterator = docIdSet == null?DocIdSet.EMPTY_DOCIDSET.Iterator() : docIdSet.Iterator();

                if (docIdSetIterator == null)
                {
                    docIdSetIterator = DocIdSet.EMPTY_DOCIDSET.Iterator();
                }
                if (docIdSetIterator.Advance(i) == i)
                {
                    return(inner);
                }
                else
                {
                    Explanation result = new Explanation(0.0f, "failure to match filter: " + f.ToString());
                    result.AddDetail(inner);
                    return(result);
                }
            }
Ejemplo n.º 2
0
            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);
            }
Ejemplo n.º 3
0
            public virtual Explanation Explain(IndexReader ir, int i)
            {
                Explanation inner = weight.Explain(ir, i);
                Filter      f     = Enclosing_Instance.filter;

                System.Collections.BitArray matches = f.Bits(ir);
                if (matches.Get(i))
                {
                    return(inner);
                }
                Explanation result = new Explanation(0.0f, "failure to match filter: " + f.ToString());

                result.AddDetail(inner);
                return(result);
            }
Ejemplo n.º 4
0
            public override Explanation Explain(AtomicReaderContext ir, int i)
            {
                Explanation      inner            = weight.Explain(ir, i);
                Filter           f                = outerInstance.filter;
                DocIdSet         docIdSet         = f.GetDocIdSet(ir, ir.AtomicReader.LiveDocs);
                DocIdSetIterator docIdSetIterator = docIdSet == null?DocIdSetIterator.GetEmpty() : docIdSet.GetIterator();

                if (docIdSetIterator == null)
                {
                    docIdSetIterator = DocIdSetIterator.GetEmpty();
                }
                if (docIdSetIterator.Advance(i) == i)
                {
                    return(inner);
                }
                else
                {
                    Explanation result = new Explanation(0.0f, "failure to match filter: " + f.ToString());
                    result.AddDetail(inner);
                    return(result);
                }
            }
Ejemplo n.º 5
0
            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;

                System.Collections.BitArray matches = f.Bits(ir);
                if (matches.Get(i))
                {
                    return(inner);
                }
                Explanation result = new Explanation(0.0f, "failure to match filter: " + f.ToString());

                result.AddDetail(inner);
                return(result);
            }
Ejemplo n.º 6
0
 public virtual Explanation Explain(IndexReader ir, int i)
 {
     return(weight.Explain(ir, i));
 }