public override void LookupOrd(long ord, BytesRef result)
            {
                if (ord < 0 || ord >= field.NumValues)
                {
                    throw new IndexOutOfRangeException("ord must be 0 .. " + (field.NumValues - 1) + "; got " + ord);
                }

                @in.Seek(field.DataStartFilePointer + ord * (9 + field.Pattern.Length + field.MaxLength));
                SimpleTextUtil.ReadLine(@in, scratch);
                Debug.Assert(StringHelper.StartsWith(scratch, SimpleTextDocValuesWriter.LENGTH),
                             "got " + scratch.Utf8ToString() + " in=" + @in);
                int len;

                try
                {
                    len =
                        (int)
                        decoder.parse(scratch.Bytes.SubList(
                                          scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length,
                                          scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length).ToString());
                }
                catch (ParseException pe)
                {
                    CorruptIndexException e =
                        new CorruptIndexException("failed to parse int length (resource=" + @in + ")");
                    e.initCause(pe);
                    throw e;
                }
                result.Bytes  = new sbyte[len];
                result.Offset = 0;
                result.Length = len;
                @in.ReadBytes(result.Bytes, 0, len);
            }
            public override int GetOrd(int docID)
            {
                if (docID < 0 || docID >= outerInstance.MAX_DOC)
                {
                    throw new IndexOutOfRangeException("docID must be 0 .. " + (outerInstance.MAX_DOC - 1) + "; got " +
                                                       docID);
                }

                @in.Seek(field.DataStartFilePointer + field.NumValues * (9 + field.Pattern.Length + field.MaxLength) +
                         docID * (1 + field.OrdPattern.Length));
                SimpleTextUtil.ReadLine(@in, scratch);
                try
                {
                    return((long)(int)ordDecoder.Parse(scratch.Utf8ToString()) - 1);
                }
                catch (ParseException pe)
                {
                    CorruptIndexException e = new CorruptIndexException("failed to parse ord (resource=" + @in + ")");
                    e.initCause(pe);
                    throw e;
                }
            }