コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
 public override void LookupOrd(long ord, BytesRef result)
 {
     // cast is ok: single-valued cannot exceed Integer.MAX_VALUE
     @in.LookupOrd((int)ord, result);
 }