public override SeekStatus SeekCeil(BytesRef text)
        {
            int ord = values.LookupTerm(text);

            if (ord >= 0)
            {
                currentOrd  = ord;
                term.Offset = 0;
                // TODO: is there a cleaner way?
                // term.bytes may be pointing to codec-private byte[]
                // storage, so we must force new byte[] allocation:
                term.Bytes = new byte[text.Length];
                term.CopyBytes(text);
                return(SeekStatus.FOUND);
            }
            else
            {
                currentOrd = -ord - 1;
                if (currentOrd == values.ValueCount)
                {
                    return(SeekStatus.END);
                }
                else
                {
                    // TODO: hmm can we avoid this "extra" lookup?:
                    values.LookupOrd(currentOrd, term);
                    return(SeekStatus.NOT_FOUND);
                }
            }
        }
Exemple #2
0
 public override long LookupTerm(BytesRef key)
 {
     return(@in.LookupTerm(key));
 }