public override Explanation Explain(AtomicReaderContext context, int docid) { BoboSegmentReader boboReader = (BoboSegmentReader)context.Reader; IFacetHandler fhandler = boboReader.GetFacetHandler(m_parent.m_name); if (fhandler != null) { BoboDocScorer scorer = null; if (fhandler is IFacetScoreable) { scorer = ((IFacetScoreable)fhandler).GetDocScorer(boboReader, m_parent.m_scoringFactory, m_parent.m_boostMap); Explanation exp1 = scorer.Explain(docid); Explanation exp2 = new Explanation(m_parent.Boost, "boost"); Explanation expl = new Explanation(); expl.Description = "product of:"; expl.Value = (exp1.Value * exp2.Value); expl.AddDetail(exp1); expl.AddDetail(exp2); return(expl); } else { return(null); } } return(null); }
public FacetTermScorer(FacetTermQuery parent, Similarity similarity, DocIdSetIterator docidsetIter, BoboDocScorer scorer) : base(new FacetTermWeight(parent, similarity)) { m_parent = parent; m_docSetIter = docidsetIter; m_scorer = scorer; }
public FacetTermScorer(FacetTermQuery parent, Similarity similarity, DocIdSetIterator docidsetIter, BoboDocScorer scorer) : base(similarity) { _parent = parent; _docSetIter = docidsetIter; _scorer = scorer; }
// NOTE: The Weight.Scorer method lost the scoreDocsInOrder and topScorer parameters between // Lucene 4.3.0 and 4.8.0. They are not used by BoboBrowse anyway, so the code here diverges // from the original Java source to remove these two parameters. // public override Scorer Scorer(AtomicReaderContext context, bool scoreDocsInOrder, bool topScorer, Bits acceptDocs) public override Scorer GetScorer(AtomicReaderContext context, IBits acceptDocs) { AtomicReader reader = context.AtomicReader; if (reader is BoboSegmentReader) { BoboSegmentReader boboReader = (BoboSegmentReader)reader; IFacetHandler fhandler = boboReader.GetFacetHandler(m_parent.m_name); if (fhandler != null) { DocIdSetIterator dociter = null; RandomAccessFilter filter = fhandler.BuildFilter(m_parent.m_sel); if (filter != null) { RandomAccessDocIdSet docset = filter.GetRandomAccessDocIdSet(boboReader); if (docset != null) { dociter = BuildIterator(docset, boboReader, acceptDocs); } } if (dociter == null) { dociter = new MatchAllDocIdSetIterator(reader, acceptDocs); } BoboDocScorer scorer = null; if (fhandler is IFacetScoreable) { scorer = ((IFacetScoreable)fhandler).GetDocScorer(boboReader, m_parent.m_scoringFactory, m_parent.m_boostMap); } return(new FacetTermScorer(m_parent, m_similarity, dociter, scorer)); } else { logger.Error("FacetHandler is not defined for the field: " + m_parent.m_name); } return(null); } else { throw new IOException("index reader not instance of " + typeof(BoboSegmentReader)); } }
public override Scorer Scorer(IndexReader reader, bool scoreDocsInOrder, bool topScorer) { if (reader is BoboIndexReader) { BoboIndexReader boboReader = (BoboIndexReader)reader; TermDocs termDocs = boboReader.TermDocs(null); IFacetHandler fhandler = boboReader.GetFacetHandler(parent._name); if (fhandler != null) { DocIdSetIterator dociter = null; RandomAccessFilter filter = fhandler.BuildFilter(parent._sel); if (filter != null) { RandomAccessDocIdSet docset = filter.GetRandomAccessDocIdSet(boboReader); if (docset != null) { dociter = BuildIterator(docset, termDocs); } } if (dociter == null) { dociter = new MatchAllDocIdSetIterator(reader); } BoboDocScorer scorer = null; if (fhandler is IFacetScoreable) { scorer = ((IFacetScoreable)fhandler).GetDocScorer(boboReader, parent._scoringFactory, parent._boostMap); } return(new FacetTermScorer(parent, _similarity, dociter, scorer)); } else { logger.Error("FacetHandler is not defined for the field: " + parent._name); } return(null); } else { throw new IOException("index reader not instance of " + typeof(BoboIndexReader)); } }
protected internal FacetTermScorer(Similarity similarity, DocIdSetIterator docidsetIter, BoboDocScorer scorer) : base(similarity) { docSetIter = docidsetIter; this.scorer = scorer; }