Beispiel #1
0
        public virtual bool Next()
        {
            if (firstTime)
            {
                InitList(true);
                ListToQueue();                 // initialize queue
                firstTime = false;
            }
            else if (more)
            {
                if (Min().Next())
                {
                    // trigger further scanning
                    queue.AdjustTop();                     // maintain queue
                }
                else
                {
                    more = false;
                }
            }

            while (more)
            {
                bool queueStale = false;

                if (Min().Doc() != max.Doc())
                {
                    // maintain list
                    QueueToList();
                    queueStale = true;
                }

                // skip to doc w/ all clauses

                while (more && first.Doc() < last.Doc())
                {
                    more = first.SkipTo(last.Doc());   // skip first upto last
                    FirstToLast();                     // and move it to the end
                    queueStale = true;
                }

                if (!more)
                {
                    return(false);
                }

                // found doc w/ all clauses

                if (queueStale)
                {
                    // maintain the queue
                    ListToQueue();
                    queueStale = false;
                }

                if (AtMatch())
                {
                    return(true);
                }

                more = Min().Next();
                if (more)
                {
                    queue.AdjustTop();                     // maintain queue
                }
            }
            return(false);            // no more matches
        }
Beispiel #2
0
        public virtual bool Next()
        {
            if (firstTime)
            {
                InitList(true);
                ListToQueue();                 // initialize queue
                firstTime = false;
            }
            else if (more)
            {
                more = Min().Next();                 // trigger further scanning
                if (more)
                {
                    queue.AdjustTop();                     // maintain queue
                }
            }

            while (more)
            {
                bool queueStale = false;

                if (Min().Doc() != max.Doc())
                {
                    // maintain list
                    QueueToList();
                    queueStale = true;
                }

                // skip to doc w/ all clauses

                while (more && first.Doc() < last.Doc())
                {
                    more = first.SkipTo(last.Doc());   // skip first upto last
                    FirstToLast();                     // and move it to the end
                    queueStale = true;
                }

                if (!more)
                {
                    return(false);
                }

                // found doc w/ all clauses

                if (queueStale)
                {
                    // maintain the queue
                    ListToQueue();
                    queueStale = false;
                }

                if (AtMatch())
                {
                    return(true);
                }

                // trigger further scanning
                if (inOrder && CheckSlop())
                {
                    /* There is a non ordered match within slop and an ordered match is needed. */
                    more = FirstNonOrderedNextToPartialList();
                    if (more)
                    {
                        PartialListToQueue();
                    }
                }
                else
                {
                    more = Min().Next();
                    if (more)
                    {
                        queue.AdjustTop();                         // maintain queue
                    }
                }
            }
            return(false);            // no more matches
        }