public override DocComparator GetComparator(IndexReader reader, int docbase)
 {
     DocComparator[] comparators = new DocComparator[_compSources.Length];
     for (int i = 0; i < _compSources.Length; ++i)
     {
         comparators[i] = _compSources[i].GetComparator(reader, docbase);
     }
     return new MultiDocIdComparator(comparators);
 }
 public override DocComparator GetComparator(IndexReader reader, int docbase)
 {
     DocComparator[] comparators = new DocComparator[_compSources.Length];
     for (int i = 0; i < _compSources.Length; ++i)
     {
         comparators[i] = _compSources[i].GetComparator(reader, docbase);
     }
     return(new MultiDocIdComparator(comparators));
 }
 public DocIDPriorityQueue(DocComparator comparator, int maxSize, int @base)
 {
     this.comparator = comparator;
     size = 0;
     this.@base = @base;
     int heapSize;
     if (0 == maxSize)
         // We allocate 1 extra to avoid if statement in top()
         heapSize = 2;
     else
         heapSize = maxSize + 1;
     this.heap = new ScoreDoc[heapSize];
 }
Beispiel #4
0
        public override void SetNextReader(IndexReader reader, int docBase)
        {
            if (!(reader is BoboIndexReader))
            {
                throw new ArgumentException("reader must be a BoboIndexReader");
            }
            _currentReader     = (BoboIndexReader)reader;
            _currentComparator = _compSource.GetComparator(reader, docBase);
            _currentQueue      = new DocIDPriorityQueue(_currentComparator, _numHits, docBase);
            if (groupBy != null)
            {
                if (_facetCountCollectorMulti != null)  // _facetCountCollectorMulti.Length >= 1
                {
                    for (int i = 0; i < _facetCountCollectorMulti.Length; ++i)
                    {
                        _facetCountCollectorMulti[i] = groupByMulti[i].GetFacetCountCollectorSource(null, null, true).GetFacetCountCollector(_currentReader, docBase);
                    }
                    //if (_facetCountCollector != null)
                    //    collectTotalGroups();
                    _facetCountCollector = _facetCountCollectorMulti[0];
                    if (_facetAccessibleLists != null)
                    {
                        for (int i = 0; i < _facetCountCollectorMulti.Length; ++i)
                        {
                            _facetAccessibleLists[i].Add(_facetCountCollectorMulti[i]);
                        }
                    }
                }
                if (_currentValueDocMaps != null)
                {
                    _currentValueDocMaps.Clear();
                }

                // NightOwl888: The _collectDocIdCache setting seems to put arrays into
                // memory, but then do nothing with the arrays. Seems wasteful and unnecessary.
                //if (contextList != null)
                //{
                //    _currentContext = new CollectorContext(_currentReader, docBase, _currentComparator);
                //    contextList.Add(_currentContext);
                //}
            }
            MyScoreDoc myScoreDoc = (MyScoreDoc)_tmpScoreDoc;

            myScoreDoc.queue     = _currentQueue;
            myScoreDoc.reader    = _currentReader;
            myScoreDoc.sortValue = null;
            _pqList.Add(_currentQueue);
            _queueFull = false;
        }
        public DocIDPriorityQueue(DocComparator comparator, int maxSize, int @base)
        {
            this.comparator = comparator;
            size            = 0;
            this.@base      = @base;
            int heapSize;

            if (0 == maxSize)
            {
                // We allocate 1 extra to avoid if statement in top()
                heapSize = 2;
            }
            else
            {
                heapSize = maxSize + 1;
            }
            this.heap = new ScoreDoc[heapSize];
        }
 public ReverseDocComparator(DocComparator comparator)
 {
     _comparator = comparator;
 }
 public ReverseDocComparator(DocComparator comparator)
 {
     _comparator = comparator;
 }
 public MultiDocIdComparable(ScoreDoc doc, DocComparator[] comparators)
 {
     _doc = doc;
     _comparators = comparators;
 }
 public MultiDocIdComparator(DocComparator[] comparators)
 {
     _comparators = comparators;
 }