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); } _input.Seek(_field.DataStartFilePointer + _field.NumValues * (9 + _field.Pattern.Length + _field.MaxLength) + docId * (1 + _field.OrdPattern.Length)); SimpleTextUtil.ReadLine(_input, _scratch); try { return(int.Parse(Decimal.Parse(_scratch.Utf8ToString()).ToString(_ordDecoderFormat)) - 1); } catch (Exception pe) { var e = new CorruptIndexException("failed to parse ord (resource=" + _input + ")", pe); throw e; } }
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); } _input.Seek(_field.DataStartFilePointer + _field.NumValues * (9 + _field.Pattern.Length + _field.MaxLength) + docId * (1 + _field.OrdPattern.Length)); SimpleTextUtil.ReadLine(_input, _scratch); try { // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. return(int.Parse(_scratch.Utf8ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture) - 1); } catch (Exception pe) { var e = new CorruptIndexException("failed to parse ord (resource=" + _input + ")", pe); throw e; } }
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; } }
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); } _input.Seek(_field.DataStartFilePointer + ord * (9 + _field.Pattern.Length + _field.MaxLength)); SimpleTextUtil.ReadLine(_input, _scratch); Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH), "got " + _scratch.Utf8ToString() + " in=" + _input); int len; try { // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. len = int.Parse(Encoding.UTF8.GetString(_scratch.Bytes, _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length), NumberStyles.Integer, CultureInfo.InvariantCulture); } catch (Exception pe) { var e = new CorruptIndexException("failed to parse int length (resource=" + _input + ")", pe); throw e; } result.Bytes = new byte[len]; result.Offset = 0; result.Length = len; _input.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); } _input.Seek(_field.DataStartFilePointer + _field.NumValues * (9 + _field.Pattern.Length + _field.MaxLength) + docId * (1 + _field.OrdPattern.Length)); SimpleTextUtil.ReadLine(_input, _scratch); try { // LUCNENENET: .NET doesn't have a way to specify a pattern with integer, but all of the standard ones are built in. return int.Parse(_scratch.Utf8ToString(), NumberStyles.Integer, CultureInfo.InvariantCulture) - 1; } catch (Exception pe) { var e = new CorruptIndexException("failed to parse ord (resource=" + _input + ")", pe); throw e; } }
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); } _input.Seek(_field.DataStartFilePointer + ord * (9 + _field.Pattern.Length + _field.MaxLength)); SimpleTextUtil.ReadLine(_input, _scratch); Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextDocValuesWriter.LENGTH), "got " + _scratch.Utf8ToString() + " in=" + _input); int len; try { len = (int) _decoderFormat.parse(_scratch.Bytes.SubList( _scratch.Offset + SimpleTextDocValuesWriter.LENGTH.Length, _scratch.Length - SimpleTextDocValuesWriter.LENGTH.Length).ToString()); } catch (Exception pe) { var e = new CorruptIndexException("failed to parse int length (resource=" + _input + ")", pe); throw e; } result.Bytes = new byte[len]; result.Offset = 0; result.Length = len; _input.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); } _input.Seek(_field.DataStartFilePointer + _field.NumValues * (9 + _field.Pattern.Length + _field.MaxLength) + docId * (1 + _field.OrdPattern.Length)); SimpleTextUtil.ReadLine(_input, _scratch); try { return _scratch.Utf8ToString().ToString(_ordDecoderFormat) - 1; } catch (Exception pe) { var e = new CorruptIndexException("failed to parse ord (resource=" + _input + ")", pe); throw e; } }