Ejemplo n.º 1
0
        public override int FetchSec(int targetSec)
        {
            while (m_curSec < SectionSearchQueryPlan.NO_MORE_SECTIONS)
            {
                m_curSec = m_positiveNode.FetchSec(targetSec);
                if (m_curSec == SectionSearchQueryPlan.NO_MORE_SECTIONS)
                {
                    break;
                }

                targetSec = m_curSec;

                if (m_negativeNode.DocId < m_curDoc)
                {
                    if (m_negativeNode.FetchDoc(m_curDoc) == DocIdSetIterator.NO_MORE_DOCS)
                    {
                        break;
                    }
                }

                if (m_negativeNode.DocId == m_curDoc &&
                    (m_negativeNode.SecId == SectionSearchQueryPlan.NO_MORE_SECTIONS ||
                     m_negativeNode.FetchSec(targetSec) > m_curSec))
                {
                    break;
                }
            }
            return(m_curSec);
        }
Ejemplo n.º 2
0
        public override int FetchDoc(int targetDoc)
        {
            if (_curDoc == DocIdSetIterator.NO_MORE_DOCS)
            {
                return(_curDoc);
            }

            SectionSearchQueryPlan node = _subqueries[0];

            _curDoc   = node.FetchDoc(targetDoc);
            targetDoc = _curDoc;

            int i = 1;

            while (i < _subqueries.Length)
            {
                node = _subqueries[i];
                if (node.DocId < targetDoc)
                {
                    _curDoc = node.FetchDoc(targetDoc);
                    if (_curDoc == DocIdSetIterator.NO_MORE_DOCS)
                    {
                        return(_curDoc);
                    }

                    if (_curDoc > targetDoc)
                    {
                        targetDoc = _curDoc;
                        i         = 0;
                        continue;
                    }
                }
                i++;
            }
            _curSec = -1;
            return(_curDoc);
        }
Ejemplo n.º 3
0
        public override int FetchDoc(int targetDoc)
        {
            if (m_curDoc == DocIdSetIterator.NO_MORE_DOCS)
            {
                return(m_curDoc);
            }

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

            m_curSec = -1;

            SectionSearchQueryPlan node = (SectionSearchQueryPlan)m_pq.Top;

            while (true)
            {
                if (node.DocId < targetDoc)
                {
                    if (node.FetchDoc(targetDoc) < DocIdSetIterator.NO_MORE_DOCS)
                    {
                        node = (SectionSearchQueryPlan)m_pq.UpdateTop();
                    }
                    else
                    {
                        m_pq.Pop();
                        if (m_pq.Count <= 0)
                        {
                            m_curDoc = DocIdSetIterator.NO_MORE_DOCS;
                            return(m_curDoc);
                        }
                        node = (SectionSearchQueryPlan)m_pq.Top;
                    }
                }
                else
                {
                    m_curDoc = node.DocId;
                    return(m_curDoc);
                }
            }
        }
Ejemplo n.º 4
0
 public override int FetchDoc(int targetDoc)
 {
     m_curDoc = m_positiveNode.FetchDoc(targetDoc);
     m_curSec = -1;
     return(m_curDoc);
 }