// 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)); } }