Esempio n. 1
0
            public virtual bool SkipTo(int target)
            {
                if (!spans.SkipTo(target))
                {
                    return(false);
                }

                if (spans.End() <= Enclosing_Instance.end)
                {
                    // there is a match
                    return(true);
                }

                return(Next());                // scan to next match
            }
Esempio n. 2
0
 public override int Advance(int target)
 {
     if (!more)
     {
         return(doc = NO_MORE_DOCS);
     }
     if (spans.Doc() < target)
     {
         // setFreqCurrentDoc() leaves spans.doc() ahead
         more = spans.SkipTo(target);
     }
     if (!SetFreqCurrentDoc())
     {
         doc = NO_MORE_DOCS;
     }
     return(doc);
 }
Esempio n. 3
0
        public override bool SkipTo(int target)
        {
            more = spans.SkipTo(target);

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

            freq = 0.0f;
            doc  = spans.Doc();

            while (more && spans.Doc() == target)
            {
                freq += GetSimilarity().SloppyFreq(spans.End() - spans.Start());
                more  = spans.Next();
            }

            return(more || freq != 0.0f);
        }
            public virtual bool SkipTo(int target)
            {
                if (length != -1)
                {
                    // subtract old length
                    Enclosing_Instance.totalLength -= length;
                }

                bool more = spans.SkipTo(target); // skip

                if (more)
                {
                    length = End() - Start();                 // compute new length
                    Enclosing_Instance.totalLength += length; // add new length to total

                    if (Enclosing_Instance.max == null || Doc() > Enclosing_Instance.max.Doc() || (Doc() == Enclosing_Instance.max.Doc() && End() > Enclosing_Instance.max.End()))
                    {
                        Enclosing_Instance.max = this;
                    }
                }

                return(more);
            }
Esempio n. 5
0
            public virtual bool SkipTo(int target)
            {
                if (firstTime)
                {
                    for (int i = 0; i < all.Count; i++)
                    {
                        Spans spans = (Spans)all[i];
                        if (spans.SkipTo(target))
                        {
                            // skip each spans in all
                            queue.Put(spans);                             // build queue
                        }
                        else
                        {
                            all.RemoveAt(i--);
                        }
                    }
                    firstTime = false;
                }
                else
                {
                    while (queue.Size() != 0 && Top().Doc() < target)
                    {
                        if (Top().SkipTo(target))
                        {
                            queue.AdjustTop();
                        }
                        else
                        {
                            all.Remove(queue.Pop());
                        }
                    }
                }

                return(queue.Size() != 0);
            }