Пример #1
0
        public override int FetchDoc(int targetDoc)
        {
            if (_curDoc == DocIdSetIterator.NO_MORE_DOCS)
            {
                return(_curDoc);
            }

            if (targetDoc <= _curDoc)
            {
                targetDoc = _curDoc + 1;
            }

            _curSec = -1;

            SectionSearchQueryPlan node = (SectionSearchQueryPlan)_pq.Top();

            while (true)
            {
                if (node.DocId < targetDoc)
                {
                    if (node.FetchDoc(targetDoc) < DocIdSetIterator.NO_MORE_DOCS)
                    {
                        node = (SectionSearchQueryPlan)_pq.UpdateTop();
                    }
                    else
                    {
                        _pq.Pop();
                        if (_pq.Size() <= 0)
                        {
                            _curDoc = DocIdSetIterator.NO_MORE_DOCS;
                            return(_curDoc);
                        }
                        node = (SectionSearchQueryPlan)_pq.Top();
                    }
                }
                else
                {
                    _curDoc = node.DocId;
                    return(_curDoc);
                }
            }
        }