示例#1
0
        public override int FetchSec(int targetSec)
        {
            TermNode firstNode = m_termNodes[0];

            while (FetchPos() < SectionSearchQueryPlan.NO_MORE_POSITIONS)
            {
                int secId = firstNode.ReadSecId();
                if (secId >= targetSec)
                {
                    targetSec = secId;
                    bool matched = true;
                    for (int i = 1; i < m_termNodes.Length; i++)
                    {
                        matched = (targetSec == m_termNodes[i].ReadSecId());
                        if (!matched)
                        {
                            break;
                        }
                    }
                    if (matched)
                    {
                        m_curSec = targetSec;
                        return(m_curSec);
                    }
                }
            }
            m_curSec = SectionSearchQueryPlan.NO_MORE_SECTIONS;
            return(m_curSec);
        }
示例#2
0
        protected override int FetchPos()
        {
            int targetPhrasePos = m_curPos + 1;

            int i = 0;

            while (i < m_termNodes.Length)
            {
                TermNode node          = m_termNodes[i];
                int      targetTermPos = (targetPhrasePos + node.PositionInPhrase);
                while (node.CurPos < targetTermPos)
                {
                    if (node.FetchPosInternal() == SectionSearchQueryPlan.NO_MORE_POSITIONS)
                    {
                        m_curPos = SectionSearchQueryPlan.NO_MORE_POSITIONS;
                        return(m_curPos);
                    }
                }
                if (node.CurPos == targetTermPos)
                {
                    i++;
                }
                else
                {
                    targetPhrasePos = node.CurPos - i;
                    i = 0;
                }
            }
            m_curPos = targetPhrasePos;
            return(m_curPos);
        }
 private SectionSearchQueryPlan TranslatePhraseQuery(PhraseQuery query)
 {
     Term[]     terms     = query.GetTerms();
     TermNode[] nodes     = new TermNode[terms.Length];
     int[]      positions = query.GetPositions();
     for (int i = 0; i < terms.Length; i++)
     {
         nodes[i] = new TermNode(terms[i], positions[i], m_reader);
     }
     return(new PhraseNode(nodes, m_reader));
 }
示例#4
0
 public PhraseNode(TermNode[] termNodes, IndexReader reader)
     : base(termNodes)
 {
     _termNodes = termNodes;
 }
 private SectionSearchQueryPlan TranslatePhraseQuery(PhraseQuery query)
 {
     Term[] terms = query.GetTerms();
     TermNode[] nodes = new TermNode[terms.Length];
     int[] positions = query.GetPositions();
     for (int i = 0; i < terms.Length; i++)
     {
         nodes[i] = new TermNode(terms[i], positions[i], _reader);
     }
     return new PhraseNode(nodes, _reader);
 }