Ejemplo n.º 1
0
        public override sealed int NextDoc()
        {
            if (_queue.Size() == 0)
            {
                return(NO_MORE_DOCS);
            }

            // TODO: move this init into positions(): if the search
            // doesn't need the positions for this doc then don't
            // waste CPU merging them:
            _posList.Clear();
            _doc = _queue.Top().DocID();

            // merge sort all positions together
            DocsAndPositionsEnum postings;

            do
            {
                postings = _queue.Top();

                int freq = postings.Freq();
                for (int i = 0; i < freq; i++)
                {
                    _posList.Add(postings.NextPosition());
                }

                if (postings.NextDoc() != NO_MORE_DOCS)
                {
                    _queue.UpdateTop();
                }
                else
                {
                    _queue.Pop();
                }
            } while (_queue.Size() > 0 && _queue.Top().DocID() == _doc);

            _posList.Sort();
            _freq = _posList.Size();

            return(_doc);
        }
Ejemplo n.º 2
0
        public bool Next()
        {
            if (_termPositionsQueue.Size() == 0)
            {
                return(false);
            }

            _posList.Clear();
            _doc = _termPositionsQueue.Peek().Doc();

            TermPositions tp;

            do
            {
                tp = _termPositionsQueue.Peek();

                for (int i = 0; i < tp.Freq(); i++)
                {
                    _posList.Add(tp.NextPosition());
                }

                if (tp.Next())
                {
                    _termPositionsQueue.AdjustTop();
                }
                else
                {
                    _termPositionsQueue.Pop();
                    tp.Close();
                }
            }while (_termPositionsQueue.Size() > 0 && _termPositionsQueue.Peek().Doc() == _doc);

            _posList.Sort();
            _freq = _posList.Size();

            return(true);
        }
 public void Clear()
 {
     _pixels.Clear();
     _palettes.Clear();
     _priorities.Clear();
 }