Пример #1
0
        public override BytesRef Next()
        {
            if (lastSeekExact)
            {
                // Must SeekCeil at this point, so those subs that
                // didn't have the term can find the following term.
                // NOTE: we could save some CPU by only SeekCeil the
                // subs that didn't match the last exact seek... but
                // most impls short-circuit if you SeekCeil to term
                // they are already on.
                SeekStatus status = SeekCeil(current);
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(status == SeekStatus.FOUND);
                }
                lastSeekExact = false;
            }
            lastSeek = null;

            // restore queue
            PushTop();

            // gather equal top fields
            if (queue.Count > 0)
            {
                PullTop();
            }
            else
            {
                current = null;
            }

            return(current);
        }
Пример #2
0
                public override bool MoveNext()
                {
                    if (seekPending) // previously positioned, but termOutputs not fetched
                    {
                        seekPending = false;
                        SeekStatus status = SeekCeil(term);
                        if (Debugging.AssertsEnabled)
                        {
                            Debugging.Assert(status == SeekStatus.FOUND);                           // must positioned on valid term
                        }
                    }
                    // LUCENENET specific - extracted logic of UpdateEnum() so we can eliminate the null check
                    var moved = fstEnum.MoveNext();

                    if (moved)
                    {
                        var pair = fstEnum.Current;
                        term                = pair.Input;
                        meta                = pair.Output;
                        state.DocFreq       = meta.docFreq;
                        state.TotalTermFreq = meta.totalTermFreq;
                    }
                    else
                    {
                        term = null;
                    }
                    decoded     = false;
                    seekPending = false;
                    return(moved);
                }
Пример #3
0
 public override BytesRef Next()
 {
     if (seekPending) // previously positioned, but termOutputs not fetched
     {
         seekPending = false;
         SeekStatus status = SeekCeil(term);
         Debug.Assert(status == SeekStatus.FOUND); // must positioned on valid term
     }
     UpdateEnum(fstEnum.Next());
     return(term);
 }
Пример #4
0
            public override SeekStatus SeekCeil(BytesRef term)
            {
                Debug.Assert(term.IsValid());
                SeekStatus result = base.SeekCeil(term);

                if (result == SeekStatus.END)
                {
                    state = State.UNPOSITIONED;
                }
                else
                {
                    state = State.POSITIONED;
                }
                return(result);
            }