Beispiel #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);
                }
            }
Beispiel #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);
            }