Beispiel #1
0
 public override DocComparer GetComparer(AtomicReader reader, int docbase)
 {
     DocComparer[] comparers = new DocComparer[m_compSources.Length];
     for (int i = 0; i < m_compSources.Length; ++i)
     {
         comparers[i] = m_compSources[i].GetComparer(reader, docbase);
     }
     return(new MultiDocIdComparer(comparers));
 }
Beispiel #2
0
        public override void SetNextReader(AtomicReaderContext context)
        {
            AtomicReader reader = context.AtomicReader;

            if (!(reader is BoboSegmentReader))
            {
                throw new ArgumentException("reader must be a BoboIndexReader");
            }
            m_currentReader = (BoboSegmentReader)reader;
            int docBase = context.DocBase;

            m_currentComparer = m_compSource.GetComparer(m_currentReader, docBase);
            m_currentQueue    = new DocIDPriorityQueue(m_currentComparer, m_numHits, docBase);
            if (m_groupBy != null)
            {
                if (m_facetCountCollectorMulti != null)  // _facetCountCollectorMulti.Length >= 1
                {
                    for (int i = 0; i < m_facetCountCollectorMulti.Length; ++i)
                    {
                        m_facetCountCollectorMulti[i] = m_groupByMulti[i].GetFacetCountCollectorSource(null, null, true).GetFacetCountCollector(m_currentReader, docBase);
                    }
                    //if (_facetCountCollector != null)
                    //    collectTotalGroups();
                    m_facetCountCollector = m_facetCountCollectorMulti[0];
                    if (m_facetAccessibleLists != null)
                    {
                        for (int i = 0; i < m_facetCountCollectorMulti.Length; ++i)
                        {
                            m_facetAccessibleLists[i].Add(m_facetCountCollectorMulti[i]);
                        }
                    }
                }
                if (m_currentValueDocMaps != null)
                {
                    m_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, _currentComparer);
                //    contextList.Add(_currentContext);
                //}
            }
            MyScoreDoc myScoreDoc = (MyScoreDoc)m_tmpScoreDoc;

            myScoreDoc.m_queue     = m_currentQueue;
            myScoreDoc.m_reader    = m_currentReader;
            myScoreDoc.m_sortValue = null;
            m_pqList.Add(m_currentQueue);
            m_queueFull = false;
        }
        public DocIDPriorityQueue(DocComparer comparer, int maxSize, int @base)
        {
            this.comparer = comparer;
            m_size        = 0;
            this.m_base   = @base;
            int heapSize;

            if (0 == maxSize)
            {
                // We allocate 1 extra to avoid if statement in top()
                heapSize = 2;
            }
            else
            {
                heapSize = maxSize + 1;
            }
            this.m_heap = new ScoreDoc[heapSize];
        }
 public ReverseDocComparer(DocComparer comparer)
 {
     m_comparer = comparer;
 }