http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs index 627c3d0..0068143 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsReader.cs @@ -69,16 +69,16 @@ namespace Lucene.Net.Codecs.Memory SeekDir(blockIn); FieldInfos fieldInfos = state.FieldInfos; - int numFields = blockIn.ReadVInt(); + int numFields = blockIn.ReadVInt32(); for (int i = 0; i < numFields; i++) { - FieldInfo fieldInfo = fieldInfos.FieldInfo(blockIn.ReadVInt()); + FieldInfo fieldInfo = fieldInfos.FieldInfo(blockIn.ReadVInt32()); bool hasFreq = fieldInfo.IndexOptions != IndexOptions.DOCS_ONLY; - long numTerms = blockIn.ReadVLong(); - long sumTotalTermFreq = hasFreq ? blockIn.ReadVLong() : -1; - long sumDocFreq = blockIn.ReadVLong(); - int docCount = blockIn.ReadVInt(); - int longsSize = blockIn.ReadVInt(); + long numTerms = blockIn.ReadVInt64(); + long sumTotalTermFreq = hasFreq ? blockIn.ReadVInt64() : -1; + long sumDocFreq = blockIn.ReadVInt64(); + int docCount = blockIn.ReadVInt32(); + int longsSize = blockIn.ReadVInt32(); var index = new FST<long?>(indexIn, PositiveIntOutputs.Singleton); var current = new TermsReader(this, fieldInfo, blockIn, numTerms, sumTotalTermFreq, sumDocFreq, docCount, longsSize, index); @@ -129,7 +129,7 @@ namespace Lucene.Net.Codecs.Memory { @in.Seek(@in.Length - 8); } - @in.Seek(@in.ReadLong()); + @in.Seek(@in.ReadInt64()); } private void CheckFieldSummary(SegmentInfo info, IndexInput indexIn, IndexInput blockIn, TermsReader field, TermsReader previous) @@ -221,9 +221,9 @@ namespace Lucene.Net.Codecs.Memory int numBlocks = (int)(numTerms + INTERVAL - 1) / INTERVAL; this.numSkipInfo = longsSize + 3; this.skipInfo = new long[numBlocks * numSkipInfo]; - this.statsBlock = new byte[(int)blockIn.ReadVLong()]; - this.metaLongsBlock = new byte[(int)blockIn.ReadVLong()]; - this.metaBytesBlock = new byte[(int)blockIn.ReadVLong()]; + this.statsBlock = new byte[(int)blockIn.ReadVInt64()]; + this.metaLongsBlock = new byte[(int)blockIn.ReadVInt64()]; + this.metaBytesBlock = new byte[(int)blockIn.ReadVInt64()]; int last = 0, next = 0; for (int i = 1; i < numBlocks; i++) @@ -231,7 +231,7 @@ namespace Lucene.Net.Codecs.Memory next = numSkipInfo * i; for (int j = 0; j < numSkipInfo; j++) { - skipInfo[next + j] = skipInfo[last + j] + blockIn.ReadVLong(); + skipInfo[next + j] = skipInfo[last + j] + blockIn.ReadVInt64(); } last = next; } @@ -408,7 +408,7 @@ namespace Lucene.Net.Codecs.Memory statsReader.Position = statsFP; for (int i = 0; i < INTERVAL && !statsReader.Eof; i++) { - int code = statsReader.ReadVInt(); + int code = statsReader.ReadVInt32(); if (outerInstance.HasFreqs) { docFreq_Renamed[i] = ((int)((uint)code >> 1)); @@ -418,7 +418,7 @@ namespace Lucene.Net.Codecs.Memory } else { - totalTermFreq_Renamed[i] = docFreq_Renamed[i] + statsReader.ReadVLong(); + totalTermFreq_Renamed[i] = docFreq_Renamed[i] + statsReader.ReadVInt64(); } } else @@ -438,18 +438,18 @@ namespace Lucene.Net.Codecs.Memory metaLongsReader.Position = metaLongsFP; for (int j = 0; j < outerInstance.longsSize; j++) { - longs[0][j] = outerInstance.skipInfo[offset + 3 + j] + metaLongsReader.ReadVLong(); + longs[0][j] = outerInstance.skipInfo[offset + 3 + j] + metaLongsReader.ReadVInt64(); } bytesStart[0] = metaBytesFP; - bytesLength[0] = (int)metaLongsReader.ReadVLong(); + bytesLength[0] = (int)metaLongsReader.ReadVInt64(); for (int i = 1; i < INTERVAL && !metaLongsReader.Eof; i++) { for (int j = 0; j < outerInstance.longsSize; j++) { - longs[i][j] = longs[i - 1][j] + metaLongsReader.ReadVLong(); + longs[i][j] = longs[i - 1][j] + metaLongsReader.ReadVInt64(); } bytesStart[i] = bytesStart[i - 1] + bytesLength[i - 1]; - bytesLength[i] = (int)metaLongsReader.ReadVLong(); + bytesLength[i] = (int)metaLongsReader.ReadVInt64(); } }
http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Memory/FSTOrdTermsWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsWriter.cs b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsWriter.cs index 9299b55..6c8a3d9 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTOrdTermsWriter.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTOrdTermsWriter.cs @@ -195,21 +195,21 @@ namespace Lucene.Net.Codecs.Memory var blockDirStart = blockOut.FilePointer; // write field summary - blockOut.WriteVInt(_fields.Count); + blockOut.WriteVInt32(_fields.Count); foreach (var field in _fields) { - blockOut.WriteVInt(field.FieldInfo.Number); - blockOut.WriteVLong(field.NumTerms); + blockOut.WriteVInt32(field.FieldInfo.Number); + blockOut.WriteVInt64(field.NumTerms); if (field.FieldInfo.IndexOptions != IndexOptions.DOCS_ONLY) { - blockOut.WriteVLong(field.SumTotalTermFreq); + blockOut.WriteVInt64(field.SumTotalTermFreq); } - blockOut.WriteVLong(field.SumDocFreq); - blockOut.WriteVInt(field.DocCount); - blockOut.WriteVInt(field.LongsSize); - blockOut.WriteVLong(field.StatsOut.FilePointer); - blockOut.WriteVLong(field.MetaLongsOut.FilePointer); - blockOut.WriteVLong(field.MetaBytesOut.FilePointer); + blockOut.WriteVInt64(field.SumDocFreq); + blockOut.WriteVInt32(field.DocCount); + blockOut.WriteVInt32(field.LongsSize); + blockOut.WriteVInt64(field.StatsOut.FilePointer); + blockOut.WriteVInt64(field.MetaLongsOut.FilePointer); + blockOut.WriteVInt64(field.MetaBytesOut.FilePointer); field.SkipOut.WriteTo(blockOut); field.StatsOut.WriteTo(blockOut); @@ -239,7 +239,7 @@ namespace Lucene.Net.Codecs.Memory private void WriteTrailer(IndexOutput output, long dirStart) { - output.WriteLong(dirStart); + output.WriteInt64(dirStart); } private class FieldMetaData @@ -332,17 +332,17 @@ namespace Lucene.Net.Codecs.Memory { if (delta == 0) { - _statsOut.WriteVInt(stats.DocFreq << 1 | 1); + _statsOut.WriteVInt32(stats.DocFreq << 1 | 1); } else { - _statsOut.WriteVInt(stats.DocFreq << 1 | 0); - _statsOut.WriteVLong(stats.TotalTermFreq - stats.DocFreq); + _statsOut.WriteVInt32(stats.DocFreq << 1 | 0); + _statsOut.WriteVInt64(stats.TotalTermFreq - stats.DocFreq); } } else { - _statsOut.WriteVInt(stats.DocFreq); + _statsOut.WriteVInt32(stats.DocFreq); } var state = _outerInstance.postingsWriter.NewTermState(); state.DocFreq = stats.DocFreq; @@ -351,12 +351,12 @@ namespace Lucene.Net.Codecs.Memory _outerInstance.postingsWriter.EncodeTerm(longs, _metaBytesOut, _fieldInfo, state, true); for (var i = 0; i < _longsSize; i++) { - _metaLongsOut.WriteVLong(longs[i] - _lastLongs[i]); + _metaLongsOut.WriteVInt64(longs[i] - _lastLongs[i]); _lastLongs[i] = longs[i]; } - _metaLongsOut.WriteVLong(_metaBytesOut.FilePointer - _lastMetaBytesFp); + _metaLongsOut.WriteVInt64(_metaBytesOut.FilePointer - _lastMetaBytesFp); - _builder.Add(Util.ToIntsRef(text, _scratchTerm), _numTerms); + _builder.Add(Util.ToInt32sRef(text, _scratchTerm), _numTerms); _numTerms++; _lastMetaBytesFp = _metaBytesOut.FilePointer; @@ -385,12 +385,12 @@ namespace Lucene.Net.Codecs.Memory private void BufferSkip() { - _skipOut.WriteVLong(_statsOut.FilePointer - _lastBlockStatsFp); - _skipOut.WriteVLong(_metaLongsOut.FilePointer - _lastBlockMetaLongsFp); - _skipOut.WriteVLong(_metaBytesOut.FilePointer - _lastBlockMetaBytesFp); + _skipOut.WriteVInt64(_statsOut.FilePointer - _lastBlockStatsFp); + _skipOut.WriteVInt64(_metaLongsOut.FilePointer - _lastBlockMetaLongsFp); + _skipOut.WriteVInt64(_metaBytesOut.FilePointer - _lastBlockMetaBytesFp); for (var i = 0; i < _longsSize; i++) { - _skipOut.WriteVLong(_lastLongs[i] - _lastBlockLongs[i]); + _skipOut.WriteVInt64(_lastLongs[i] - _lastBlockLongs[i]); } _lastBlockStatsFp = _statsOut.FilePointer; _lastBlockMetaLongsFp = _metaLongsOut.FilePointer; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Memory/FSTTermOutputs.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermOutputs.cs b/src/Lucene.Net.Codecs/Memory/FSTTermOutputs.cs index 376896b..33d614c 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTTermOutputs.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTTermOutputs.cs @@ -261,7 +261,7 @@ namespace Lucene.Net.Codecs.Memory else { output.WriteByte((byte) bits); - output.WriteVInt(data.bytes.Length); + output.WriteVInt32(data.bytes.Length); } } else @@ -272,7 +272,7 @@ namespace Lucene.Net.Codecs.Memory { for (int pos = 0; pos < _longsSize; pos++) { - output.WriteVLong(data.longs[pos]); + output.WriteVInt64(data.longs[pos]); } } if (bit1 > 0) // bytes exists @@ -285,17 +285,17 @@ namespace Lucene.Net.Codecs.Memory { if (data.docFreq == data.totalTermFreq) { - output.WriteVInt((data.docFreq << 1) | 1); + output.WriteVInt32((data.docFreq << 1) | 1); } else { - output.WriteVInt((data.docFreq << 1)); - output.WriteVLong(data.totalTermFreq - data.docFreq); + output.WriteVInt32((data.docFreq << 1)); + output.WriteVInt64(data.totalTermFreq - data.docFreq); } } else { - output.WriteVInt(data.docFreq); + output.WriteVInt32(data.docFreq); } } } @@ -313,13 +313,13 @@ namespace Lucene.Net.Codecs.Memory var bytesSize = ((int) ((uint) bits >> 3)); if (bit1 > 0 && bytesSize == 0) // determine extra length { - bytesSize = input.ReadVInt(); + bytesSize = input.ReadVInt32(); } if (bit0 > 0) // not all-zero case { for (int pos = 0; pos < _longsSize; pos++) { - longs[pos] = input.ReadVLong(); + longs[pos] = input.ReadVInt64(); } } if (bit1 > 0) // bytes exists @@ -329,13 +329,13 @@ namespace Lucene.Net.Codecs.Memory } if (bit2 > 0) // stats exist { - int code = input.ReadVInt(); + int code = input.ReadVInt32(); if (_hasPos) { totalTermFreq = docFreq = (int) ((uint) code >> 1); if ((code & 1) == 0) { - totalTermFreq += input.ReadVLong(); + totalTermFreq += input.ReadVInt64(); } } else http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs index 2e77f4b..b2cf9b8 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTTermsReader.cs @@ -82,16 +82,16 @@ namespace Lucene.Net.Codecs.Memory SeekDir(@in); FieldInfos fieldInfos = state.FieldInfos; - int numFields = @in.ReadVInt(); + int numFields = @in.ReadVInt32(); for (int i = 0; i < numFields; i++) { - int fieldNumber = @in.ReadVInt(); + int fieldNumber = @in.ReadVInt32(); FieldInfo fieldInfo = fieldInfos.FieldInfo(fieldNumber); - long numTerms = @in.ReadVLong(); - long sumTotalTermFreq = fieldInfo.IndexOptions == IndexOptions.DOCS_ONLY ? -1 : @in.ReadVLong(); - long sumDocFreq = @in.ReadVLong(); - int docCount = @in.ReadVInt(); - int longsSize = @in.ReadVInt(); + long numTerms = @in.ReadVInt64(); + long sumTotalTermFreq = fieldInfo.IndexOptions == IndexOptions.DOCS_ONLY ? -1 : @in.ReadVInt64(); + long sumDocFreq = @in.ReadVInt64(); + int docCount = @in.ReadVInt32(); + int longsSize = @in.ReadVInt32(); TermsReader current = new TermsReader(this, fieldInfo, @in, numTerms, sumTotalTermFreq, sumDocFreq, docCount, longsSize); TermsReader previous; // LUCENENET NOTE: This simulates a put operation in Java, @@ -130,7 +130,7 @@ namespace Lucene.Net.Codecs.Memory { @in.Seek(@in.Length - 8); } - @in.Seek(@in.ReadLong()); + @in.Seek(@in.ReadInt64()); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Memory/FSTTermsWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/FSTTermsWriter.cs b/src/Lucene.Net.Codecs/Memory/FSTTermsWriter.cs index 9d7e448..9f01c13 100644 --- a/src/Lucene.Net.Codecs/Memory/FSTTermsWriter.cs +++ b/src/Lucene.Net.Codecs/Memory/FSTTermsWriter.cs @@ -156,7 +156,7 @@ namespace Lucene.Net.Codecs.Memory private void WriteTrailer(IndexOutput output, long dirStart) { - output.WriteLong(dirStart); + output.WriteInt64(dirStart); } public override TermsConsumer AddField(FieldInfo field) @@ -174,18 +174,18 @@ namespace Lucene.Net.Codecs.Memory // write field summary var dirStart = _output.FilePointer; - _output.WriteVInt(_fields.Count); + _output.WriteVInt32(_fields.Count); foreach (var field in _fields) { - _output.WriteVInt(field.FieldInfo.Number); - _output.WriteVLong(field.NumTerms); + _output.WriteVInt32(field.FieldInfo.Number); + _output.WriteVInt64(field.NumTerms); if (field.FieldInfo.IndexOptions != IndexOptions.DOCS_ONLY) { - _output.WriteVLong(field.SumTotalTermFreq); + _output.WriteVInt64(field.SumTotalTermFreq); } - _output.WriteVLong(field.SumDocFreq); - _output.WriteVInt(field.DocCount); - _output.WriteVInt(field.LongsSize); + _output.WriteVInt64(field.SumDocFreq); + _output.WriteVInt32(field.DocCount); + _output.WriteVInt32(field.LongsSize); field.Dict.Save(_output); } WriteTrailer(_output, dirStart); @@ -282,7 +282,7 @@ namespace Lucene.Net.Codecs.Memory _metaWriter.WriteTo(meta.bytes, 0); _metaWriter.Reset(); } - _builder.Add(Util.ToIntsRef(text, _scratchTerm), meta); + _builder.Add(Util.ToInt32sRef(text, _scratchTerm), meta); _numTerms++; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs index ce252f3..94224fc 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesConsumer.cs @@ -84,9 +84,9 @@ namespace Lucene.Net.Codecs.Memory internal virtual void AddNumericField(FieldInfo field, IEnumerable<long?> values, bool optimizeStorage) { - meta.WriteVInt(field.Number); + meta.WriteVInt32(field.Number); meta.WriteByte(MemoryDocValuesProducer.NUMBER); - meta.WriteLong(data.FilePointer); + meta.WriteInt64(data.FilePointer); long minValue = long.MaxValue; long maxValue = long.MinValue; long gcd = 0; @@ -149,12 +149,12 @@ namespace Lucene.Net.Codecs.Memory { long start = data.FilePointer; WriteMissingBitset(values); - meta.WriteLong(start); - meta.WriteLong(data.FilePointer - start); + meta.WriteInt64(start); + meta.WriteInt64(data.FilePointer - start); } else { - meta.WriteLong(-1L); + meta.WriteInt64(-1L); } if (uniqueValues != null) @@ -178,16 +178,16 @@ namespace Lucene.Net.Codecs.Memory long?[] decode = uniqueValues.ToArray(); var encode = new Dictionary<long?, int?>(); - data.WriteVInt(decode.Length); + data.WriteVInt32(decode.Length); for (int i = 0; i < decode.Length; i++) { - data.WriteLong(decode[i].Value); + data.WriteInt64(decode[i].Value); encode[decode[i]] = i; } - meta.WriteVInt(PackedInts.VERSION_CURRENT); - data.WriteVInt(formatAndBits.Format.Id); - data.WriteVInt(formatAndBits.BitsPerValue); + meta.WriteVInt32(PackedInts.VERSION_CURRENT); + data.WriteVInt32(formatAndBits.Format.Id); + data.WriteVInt32(formatAndBits.BitsPerValue); PackedInts.Writer writer = PackedInts.GetWriterNoHeader(data, formatAndBits.Format, maxDoc, formatAndBits.BitsPerValue, PackedInts.DEFAULT_BUFFER_SIZE); @@ -203,10 +203,10 @@ namespace Lucene.Net.Codecs.Memory else if (gcd != 0 && gcd != 1) { meta.WriteByte(MemoryDocValuesProducer.GCD_COMPRESSED); - meta.WriteVInt(PackedInts.VERSION_CURRENT); - data.WriteLong(minValue); - data.WriteLong(gcd); - data.WriteVInt(MemoryDocValuesProducer.BLOCK_SIZE); + meta.WriteVInt32(PackedInts.VERSION_CURRENT); + data.WriteInt64(minValue); + data.WriteInt64(gcd); + data.WriteVInt32(MemoryDocValuesProducer.BLOCK_SIZE); var writer = new BlockPackedWriter(data, MemoryDocValuesProducer.BLOCK_SIZE); foreach (var nv in values) @@ -219,8 +219,8 @@ namespace Lucene.Net.Codecs.Memory { meta.WriteByte(MemoryDocValuesProducer.DELTA_COMPRESSED); // delta-compressed - meta.WriteVInt(PackedInts.VERSION_CURRENT); - data.WriteVInt(MemoryDocValuesProducer.BLOCK_SIZE); + meta.WriteVInt32(PackedInts.VERSION_CURRENT); + data.WriteVInt32(MemoryDocValuesProducer.BLOCK_SIZE); var writer = new BlockPackedWriter(data, MemoryDocValuesProducer.BLOCK_SIZE); foreach (var nv in values) @@ -240,7 +240,7 @@ namespace Lucene.Net.Codecs.Memory { if (meta != null) { - meta.WriteVInt(-1); // write EOF marker + meta.WriteVInt32(-1); // write EOF marker CodecUtil.WriteFooter(meta); // write checksum } if (data != null) @@ -266,7 +266,7 @@ namespace Lucene.Net.Codecs.Memory public override void AddBinaryField(FieldInfo field, IEnumerable<BytesRef> values) { // write the byte[] data - meta.WriteVInt(field.Number); + meta.WriteVInt32(field.Number); meta.WriteByte(MemoryDocValuesProducer.BYTES); var minLength = int.MaxValue; var maxLength = int.MinValue; @@ -297,28 +297,28 @@ namespace Lucene.Net.Codecs.Memory data.WriteBytes(v.Bytes, v.Offset, v.Length); } } - meta.WriteLong(startFP); - meta.WriteLong(data.FilePointer - startFP); + meta.WriteInt64(startFP); + meta.WriteInt64(data.FilePointer - startFP); if (missing) { long start = data.FilePointer; WriteMissingBitset(values); - meta.WriteLong(start); - meta.WriteLong(data.FilePointer - start); + meta.WriteInt64(start); + meta.WriteInt64(data.FilePointer - start); } else { - meta.WriteLong(-1L); + meta.WriteInt64(-1L); } - meta.WriteVInt(minLength); - meta.WriteVInt(maxLength); + meta.WriteVInt32(minLength); + meta.WriteVInt32(maxLength); // if minLength == maxLength, its a fixed-length byte[], we are done (the addresses are implicit) // otherwise, we need to record the length fields... if (minLength != maxLength) { - meta.WriteVInt(PackedInts.VERSION_CURRENT); - meta.WriteVInt(MemoryDocValuesProducer.BLOCK_SIZE); + meta.WriteVInt32(PackedInts.VERSION_CURRENT); + meta.WriteVInt32(MemoryDocValuesProducer.BLOCK_SIZE); var writer = new MonotonicBlockPackedWriter(data, MemoryDocValuesProducer.BLOCK_SIZE); @@ -337,16 +337,16 @@ namespace Lucene.Net.Codecs.Memory private void WriteFST(FieldInfo field, IEnumerable<BytesRef> values) { - meta.WriteVInt(field.Number); + meta.WriteVInt32(field.Number); meta.WriteByte(MemoryDocValuesProducer.FST); - meta.WriteLong(data.FilePointer); + meta.WriteInt64(data.FilePointer); PositiveIntOutputs outputs = PositiveIntOutputs.Singleton; var builder = new Builder<long?>(INPUT_TYPE.BYTE1, outputs); var scratch = new IntsRef(); long ord = 0; foreach (BytesRef v in values) { - builder.Add(Util.ToIntsRef(v, scratch), ord); + builder.Add(Util.ToInt32sRef(v, scratch), ord); ord++; } FST<long?> fst = builder.Finish(); @@ -354,7 +354,7 @@ namespace Lucene.Net.Codecs.Memory { fst.Save(data); } - meta.WriteVLong(ord); + meta.WriteVInt64(ord); } // TODO: in some cases representing missing with minValue-1 wouldn't take up additional space and so on, @@ -368,7 +368,7 @@ namespace Lucene.Net.Codecs.Memory { if (count == 64) { - data.WriteLong(bits); + data.WriteInt64(bits); count = 0; bits = 0; } @@ -380,7 +380,7 @@ namespace Lucene.Net.Codecs.Memory } if (count > 0) { - data.WriteLong(bits); + data.WriteInt64(bits); } } @@ -493,7 +493,7 @@ namespace Lucene.Net.Codecs.Memory break; long ord = ords.Current.Value; - @out.WriteVLong(ord - lastOrd); + @out.WriteVInt64(ord - lastOrd); lastOrd = ord; } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs index 4ff434c..cab8547 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryDocValuesProducer.cs @@ -134,16 +134,16 @@ namespace Lucene.Net.Codecs.Memory private void ReadFields(IndexInput meta, FieldInfos infos) { - int fieldNumber = meta.ReadVInt(); + int fieldNumber = meta.ReadVInt32(); while (fieldNumber != -1) { int fieldType = meta.ReadByte(); if (fieldType == NUMBER) { - var entry = new NumericEntry {offset = meta.ReadLong(), missingOffset = meta.ReadLong()}; + var entry = new NumericEntry {offset = meta.ReadInt64(), missingOffset = meta.ReadInt64()}; if (entry.missingOffset != -1) { - entry.missingBytes = meta.ReadLong(); + entry.missingBytes = meta.ReadInt64(); } else { @@ -162,7 +162,7 @@ namespace Lucene.Net.Codecs.Memory } if (entry.format != UNCOMPRESSED) { - entry.packedIntsVersion = meta.ReadVInt(); + entry.packedIntsVersion = meta.ReadVInt32(); } numerics[fieldNumber] = entry; } @@ -170,37 +170,37 @@ namespace Lucene.Net.Codecs.Memory { var entry = new BinaryEntry { - offset = meta.ReadLong(), - numBytes = meta.ReadLong(), - missingOffset = meta.ReadLong() + offset = meta.ReadInt64(), + numBytes = meta.ReadInt64(), + missingOffset = meta.ReadInt64() }; if (entry.missingOffset != -1) { - entry.missingBytes = meta.ReadLong(); + entry.missingBytes = meta.ReadInt64(); } else { entry.missingBytes = 0; } - entry.minLength = meta.ReadVInt(); - entry.maxLength = meta.ReadVInt(); + entry.minLength = meta.ReadVInt32(); + entry.maxLength = meta.ReadVInt32(); if (entry.minLength != entry.maxLength) { - entry.packedIntsVersion = meta.ReadVInt(); - entry.blockSize = meta.ReadVInt(); + entry.packedIntsVersion = meta.ReadVInt32(); + entry.blockSize = meta.ReadVInt32(); } binaries[fieldNumber] = entry; } else if (fieldType == FST) { - var entry = new FSTEntry {offset = meta.ReadLong(), numOrds = meta.ReadVLong()}; + var entry = new FSTEntry {offset = meta.ReadInt64(), numOrds = meta.ReadVInt64()}; fsts[fieldNumber] = entry; } else { throw new CorruptIndexException("invalid entry type: " + fieldType + ", input=" + meta); } - fieldNumber = meta.ReadVInt(); + fieldNumber = meta.ReadVInt32(); } } @@ -238,7 +238,7 @@ namespace Lucene.Net.Codecs.Memory switch (entry.format) { case TABLE_COMPRESSED: - int size = data.ReadVInt(); + int size = data.ReadVInt32(); if (size > 256) { throw new CorruptIndexException( @@ -247,16 +247,16 @@ namespace Lucene.Net.Codecs.Memory var decode = new long[size]; for (int i = 0; i < decode.Length; i++) { - decode[i] = data.ReadLong(); + decode[i] = data.ReadInt64(); } - int formatID = data.ReadVInt(); - int bitsPerValue = data.ReadVInt(); + int formatID = data.ReadVInt32(); + int bitsPerValue = data.ReadVInt32(); var ordsReader = PackedInts.GetReaderNoHeader(data, PackedInts.Format.ById(formatID), entry.packedIntsVersion, maxDoc, bitsPerValue); ramBytesUsed.AddAndGet(RamUsageEstimator.SizeOf(decode) + ordsReader.RamBytesUsed()); return new NumericDocValuesAnonymousInnerClassHelper(this, decode, ordsReader); case DELTA_COMPRESSED: - int blockSize = data.ReadVInt(); + int blockSize = data.ReadVInt32(); var reader = new BlockPackedReader(data, entry.packedIntsVersion, blockSize, maxDoc, false); ramBytesUsed.AddAndGet(reader.RamBytesUsed()); @@ -268,9 +268,9 @@ namespace Lucene.Net.Codecs.Memory // LUCENENET: IMPORTANT - some bytes are negative here, so we need to pass as sbyte return new NumericDocValuesAnonymousInnerClassHelper2(this, (sbyte[])(Array)bytes); case GCD_COMPRESSED: - long min = data.ReadLong(); - long mult = data.ReadLong(); - int quotientBlockSize = data.ReadVInt(); + long min = data.ReadInt64(); + long mult = data.ReadInt64(); + int quotientBlockSize = data.ReadVInt32(); var quotientReader = new BlockPackedReader(data, entry.packedIntsVersion, quotientBlockSize, maxDoc, false); ramBytesUsed.AddAndGet(quotientReader.RamBytesUsed()); @@ -603,7 +603,7 @@ namespace Lucene.Net.Codecs.Memory } else { - currentOrd += input.ReadVLong(); + currentOrd += input.ReadVInt64(); return currentOrd; } } @@ -687,7 +687,7 @@ namespace Lucene.Net.Codecs.Memory var bits = new long[(int) length >> 3]; for (var i = 0; i < bits.Length; i++) { - bits[i] = data.ReadLong(); + bits[i] = data.ReadInt64(); } instance = new FixedBitSet(bits, maxDoc); docsWithFieldInstances[fieldNumber] = instance; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs index 3fda936..50e1116 100644 --- a/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs +++ b/src/Lucene.Net.Codecs/Memory/MemoryPostingsFormat.cs @@ -149,17 +149,17 @@ namespace Lucene.Net.Codecs.Memory if (outerInstance.field.IndexOptions == IndexOptions.DOCS_ONLY) { - buffer.WriteVInt(delta); + buffer.WriteVInt32(delta); } else if (termDocFreq == 1) { - buffer.WriteVInt((delta << 1) | 1); + buffer.WriteVInt32((delta << 1) | 1); } else { - buffer.WriteVInt(delta << 1); + buffer.WriteVInt32(delta << 1); Debug.Assert(termDocFreq > 0); - buffer.WriteVInt(termDocFreq); + buffer.WriteVInt32(termDocFreq); } lastPos = 0; @@ -184,17 +184,17 @@ namespace Lucene.Net.Codecs.Memory if (payloadLen != lastPayloadLen) { lastPayloadLen = payloadLen; - buffer.WriteVInt((delta << 1) | 1); - buffer.WriteVInt(payloadLen); + buffer.WriteVInt32((delta << 1) | 1); + buffer.WriteVInt32(payloadLen); } else { - buffer.WriteVInt(delta << 1); + buffer.WriteVInt32(delta << 1); } } else { - buffer.WriteVInt(delta); + buffer.WriteVInt32(delta); } if (outerInstance.field.IndexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0) @@ -205,12 +205,12 @@ namespace Lucene.Net.Codecs.Memory int offsetLength = endOffset - startOffset; if (offsetLength != lastOffsetLength) { - buffer.WriteVInt(offsetDelta << 1 | 1); - buffer.WriteVInt(offsetLength); + buffer.WriteVInt32(offsetDelta << 1 | 1); + buffer.WriteVInt32(offsetLength); } else { - buffer.WriteVInt(offsetDelta << 1); + buffer.WriteVInt32(offsetDelta << 1); } lastOffset = startOffset; lastOffsetLength = offsetLength; @@ -256,10 +256,10 @@ namespace Lucene.Net.Codecs.Memory Debug.Assert(buffer2.FilePointer == 0); - buffer2.WriteVInt(stats.DocFreq); + buffer2.WriteVInt32(stats.DocFreq); if (field.IndexOptions != IndexOptions.DOCS_ONLY) { - buffer2.WriteVLong(stats.TotalTermFreq - stats.DocFreq); + buffer2.WriteVInt64(stats.TotalTermFreq - stats.DocFreq); } int pos = (int)buffer2.FilePointer; buffer2.WriteTo(finalBuffer, 0); @@ -281,7 +281,7 @@ namespace Lucene.Net.Codecs.Memory // System.out.println(" " + Integer.toHexString(finalBuffer[i]&0xFF)); //} - builder.Add(Util.ToIntsRef(text, scratchIntsRef), BytesRef.DeepCopyOf(spare)); + builder.Add(Util.ToInt32sRef(text, scratchIntsRef), BytesRef.DeepCopyOf(spare)); termCount++; } @@ -289,14 +289,14 @@ namespace Lucene.Net.Codecs.Memory { if (termCount > 0) { - @out.WriteVInt(termCount); - @out.WriteVInt(field.Number); + @out.WriteVInt32(termCount); + @out.WriteVInt32(field.Number); if (field.IndexOptions != IndexOptions.DOCS_ONLY) { - @out.WriteVLong(sumTotalTermFreq); + @out.WriteVInt64(sumTotalTermFreq); } - @out.WriteVLong(sumDocFreq); - @out.WriteVInt(docCount); + @out.WriteVInt64(sumDocFreq); + @out.WriteVInt32(docCount); FST<BytesRef> fst = builder.Finish(); fst.Save(@out); //System.out.println("finish field=" + field.name + " fp=" + out.getFilePointer()); @@ -362,7 +362,7 @@ namespace Lucene.Net.Codecs.Memory // EOF marker: try { - @out.WriteVInt(0); + @out.WriteVInt32(0); CodecUtil.WriteFooter(@out); } finally @@ -433,11 +433,11 @@ namespace Lucene.Net.Codecs.Memory docUpto++; if (indexOptions == IndexOptions.DOCS_ONLY) { - accum += @in.ReadVInt(); + accum += @in.ReadVInt32(); } else { - int code = @in.ReadVInt(); + int code = @in.ReadVInt32(); accum += (int)((uint)code >> 1); //System.out.println(" docID=" + accum + " code=" + code); if ((code & 1) != 0) @@ -446,7 +446,7 @@ namespace Lucene.Net.Codecs.Memory } else { - freq_Renamed = @in.ReadVInt(); + freq_Renamed = @in.ReadVInt32(); Debug.Assert(freq_Renamed > 0); } @@ -457,14 +457,14 @@ namespace Lucene.Net.Codecs.Memory { if (!storePayloads) { - @in.ReadVInt(); + @in.ReadVInt32(); } else { - int posCode = @in.ReadVInt(); + int posCode = @in.ReadVInt32(); if ((posCode & 1) != 0) { - payloadLen = @in.ReadVInt(); + payloadLen = @in.ReadVInt32(); } @in.SkipBytes(payloadLen); } @@ -475,15 +475,15 @@ namespace Lucene.Net.Codecs.Memory // Skip positions/offsets/payloads for (int posUpto = 0; posUpto < freq_Renamed; posUpto++) { - int posCode = @in.ReadVInt(); + int posCode = @in.ReadVInt32(); if (storePayloads && ((posCode & 1) != 0)) { - payloadLen = @in.ReadVInt(); + payloadLen = @in.ReadVInt32(); } - if ((@in.ReadVInt() & 1) != 0) + if ((@in.ReadVInt32() & 1) != 0) { // new offset length - @in.ReadVInt(); + @in.ReadVInt32(); } if (storePayloads) { @@ -604,7 +604,7 @@ namespace Lucene.Net.Codecs.Memory } docUpto++; - int code = @in.ReadVInt(); + int code = @in.ReadVInt32(); accum += (int)((uint)code >> 1); if ((code & 1) != 0) { @@ -612,7 +612,7 @@ namespace Lucene.Net.Codecs.Memory } else { - freq_Renamed = @in.ReadVInt(); + freq_Renamed = @in.ReadVInt32(); Debug.Assert(freq_Renamed > 0); } @@ -630,24 +630,24 @@ namespace Lucene.Net.Codecs.Memory { if (!storePayloads) { - @in.ReadVInt(); + @in.ReadVInt32(); } else { - int skipCode = @in.ReadVInt(); + int skipCode = @in.ReadVInt32(); if ((skipCode & 1) != 0) { - payloadLength = @in.ReadVInt(); + payloadLength = @in.ReadVInt32(); //System.out.println(" new payloadLen=" + payloadLength); } } if (storeOffsets) { - if ((@in.ReadVInt() & 1) != 0) + if ((@in.ReadVInt32() & 1) != 0) { // new offset length - offsetLength = @in.ReadVInt(); + offsetLength = @in.ReadVInt32(); } } @@ -666,15 +666,15 @@ namespace Lucene.Net.Codecs.Memory posPending--; if (!storePayloads) { - pos += @in.ReadVInt(); + pos += @in.ReadVInt32(); } else { - int code = @in.ReadVInt(); + int code = @in.ReadVInt32(); pos += (int)((uint)code >> 1); if ((code & 1) != 0) { - payloadLength = @in.ReadVInt(); + payloadLength = @in.ReadVInt32(); //System.out.println(" new payloadLen=" + payloadLength); //} else { //System.out.println(" same payloadLen=" + payloadLength); @@ -683,11 +683,11 @@ namespace Lucene.Net.Codecs.Memory if (storeOffsets) { - int offsetCode = @in.ReadVInt(); + int offsetCode = @in.ReadVInt32(); if ((offsetCode & 1) != 0) { // new offset length - offsetLength = @in.ReadVInt(); + offsetLength = @in.ReadVInt32(); } startOffset_Renamed += (int)((uint)offsetCode >> 1); } @@ -766,10 +766,10 @@ namespace Lucene.Net.Codecs.Memory if (!didDecode) { buffer.Reset(current.Output.Bytes, current.Output.Offset, current.Output.Length); - docFreq_Renamed = buffer.ReadVInt(); + docFreq_Renamed = buffer.ReadVInt32(); if (field.IndexOptions != IndexOptions.DOCS_ONLY) { - totalTermFreq_Renamed = docFreq_Renamed + buffer.ReadVLong(); + totalTermFreq_Renamed = docFreq_Renamed + buffer.ReadVInt64(); } else { @@ -941,18 +941,18 @@ namespace Lucene.Net.Codecs.Memory public TermsReader(FieldInfos fieldInfos, IndexInput @in, int termCount) { this.termCount = termCount; - int fieldNumber = @in.ReadVInt(); + int fieldNumber = @in.ReadVInt32(); field = fieldInfos.FieldInfo(fieldNumber); if (field.IndexOptions != IndexOptions.DOCS_ONLY) { - sumTotalTermFreq = @in.ReadVLong(); + sumTotalTermFreq = @in.ReadVInt64(); } else { sumTotalTermFreq = -1; } - sumDocFreq = @in.ReadVLong(); - docCount = @in.ReadVInt(); + sumDocFreq = @in.ReadVInt64(); + docCount = @in.ReadVInt32(); fst = new FST<BytesRef>(@in, outputs); } @@ -1036,7 +1036,7 @@ namespace Lucene.Net.Codecs.Memory CodecUtil.CheckHeader(@in, CODEC_NAME, VERSION_START, VERSION_CURRENT); while (true) { - int termCount = @in.ReadVInt(); + int termCount = @in.ReadVInt32(); if (termCount == 0) { break; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs index 3592de9..941b080 100644 --- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs +++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsReader.cs @@ -56,7 +56,7 @@ namespace Lucene.Net.Codecs.Pulsing PulsingPostingsWriter.VERSION_START, PulsingPostingsWriter.VERSION_CURRENT); - _maxPositions = termsIn.ReadVInt(); + _maxPositions = termsIn.ReadVInt32(); _wrappedPostingsReader.Init(termsIn); if (_wrappedPostingsReader is PulsingPostingsReader || _version < PulsingPostingsWriter.VERSION_META_ARRAY) @@ -79,11 +79,11 @@ namespace Lucene.Net.Codecs.Pulsing _version, PulsingPostingsWriter.VERSION_CURRENT); - var numField = input.ReadVInt(); + var numField = input.ReadVInt32(); for (var i = 0; i < numField; i++) { - var fieldNum = input.ReadVInt(); - var longsSize = input.ReadVInt(); + var fieldNum = input.ReadVInt32(); + var longsSize = input.ReadVInt32(); _fields.Add(fieldNum, longsSize); } } @@ -180,7 +180,7 @@ namespace Lucene.Net.Codecs.Pulsing // Inlined into terms dict -- just read the byte[] blob in, // but don't decode it now (we only decode when a DocsEnum // or D&PEnum is pulled): - termState2.PostingsSize = input.ReadVInt(); + termState2.PostingsSize = input.ReadVInt32(); if (termState2.Postings == null || termState2.Postings.Length < termState2.PostingsSize) { termState2.Postings = new byte[ArrayUtil.Oversize(termState2.PostingsSize, 1)]; @@ -202,7 +202,7 @@ namespace Lucene.Net.Codecs.Pulsing } for (var i = 0; i < longsSize; i++) { - termState2.Longs[i] = input.ReadVLong(); + termState2.Longs[i] = input.ReadVInt64(); } termState2.PostingsSize = -1; termState2.WrappedTermState.DocFreq = termState2.DocFreq; @@ -368,7 +368,7 @@ namespace Lucene.Net.Codecs.Pulsing if (_postings.Eof) return _docId = NO_MORE_DOCS; - var code = _postings.ReadVInt(); + var code = _postings.ReadVInt32(); if (_indexOptions == IndexOptions.DOCS_ONLY) { _accum += code; @@ -376,7 +376,7 @@ namespace Lucene.Net.Codecs.Pulsing else { _accum += (int)((uint)code >> 1); ; // shift off low bit - _freq = (code & 1) != 0 ? 1 : _postings.ReadVInt(); + _freq = (code & 1) != 0 ? 1 : _postings.ReadVInt32(); if (_indexOptions.Value.CompareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS) >= 0) { @@ -385,15 +385,15 @@ namespace Lucene.Net.Codecs.Pulsing { for (var pos = 0; pos < _freq; pos++) { - var posCode = _postings.ReadVInt(); + var posCode = _postings.ReadVInt32(); if ((posCode & 1) != 0) { - _payloadLength = _postings.ReadVInt(); + _payloadLength = _postings.ReadVInt32(); } - if (_storeOffsets && (_postings.ReadVInt() & 1) != 0) + if (_storeOffsets && (_postings.ReadVInt32() & 1) != 0) { // new offset length - _postings.ReadVInt(); + _postings.ReadVInt32(); } if (_payloadLength != 0) { @@ -406,11 +406,11 @@ namespace Lucene.Net.Codecs.Pulsing for (var pos = 0; pos < _freq; pos++) { // TODO: skipVInt - _postings.ReadVInt(); - if (_storeOffsets && (_postings.ReadVInt() & 1) != 0) + _postings.ReadVInt32(); + if (_storeOffsets && (_postings.ReadVInt32() & 1) != 0) { // new offset length - _postings.ReadVInt(); + _postings.ReadVInt32(); } } } @@ -518,9 +518,9 @@ namespace Lucene.Net.Codecs.Pulsing return _docId = NO_MORE_DOCS; } - var code = _postings.ReadVInt(); + var code = _postings.ReadVInt32(); _accum += (int)((uint)code >> 1); // shift off low bit - _freq = (code & 1) != 0 ? 1 : _postings.ReadVInt(); + _freq = (code & 1) != 0 ? 1 : _postings.ReadVInt32(); _posPending = _freq; _startOffset = _storeOffsets ? 0 : -1; // always return -1 if no offsets are stored @@ -558,26 +558,26 @@ namespace Lucene.Net.Codecs.Pulsing { _postings.SkipBytes(_payloadLength); } - int code = _postings.ReadVInt(); + int code = _postings.ReadVInt32(); if ((code & 1) != 0) { - _payloadLength = _postings.ReadVInt(); + _payloadLength = _postings.ReadVInt32(); } _position += (int)((uint)code >> 1); _payloadRetrieved = false; } else { - _position += _postings.ReadVInt(); + _position += _postings.ReadVInt32(); } if (_storeOffsets) { - int offsetCode = _postings.ReadVInt(); + int offsetCode = _postings.ReadVInt32(); if ((offsetCode & 1) != 0) { // new offset length - _offsetLength = _postings.ReadVInt(); + _offsetLength = _postings.ReadVInt32(); } _startOffset += (int)((uint)offsetCode >> 1); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs index 729aa2a..acc29f0 100644 --- a/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs +++ b/src/Lucene.Net.Codecs/Pulsing/PulsingPostingsWriter.cs @@ -133,7 +133,7 @@ namespace Lucene.Net.Codecs.Pulsing { _termsOut = termsOut; CodecUtil.WriteHeader(termsOut, CODEC, VERSION_CURRENT); - termsOut.WriteVInt(_pending.Length); // encode maxPositions in header + termsOut.WriteVInt32(_pending.Length); // encode maxPositions in header _wrappedPostingsWriter.Init(termsOut); } @@ -302,12 +302,12 @@ namespace Lucene.Net.Codecs.Pulsing if (doc.termFreq == 1) { - _buffer.WriteVInt((delta << 1) | 1); + _buffer.WriteVInt32((delta << 1) | 1); } else { - _buffer.WriteVInt(delta << 1); - _buffer.WriteVInt(doc.termFreq); + _buffer.WriteVInt32(delta << 1); + _buffer.WriteVInt32(doc.termFreq); } var lastPos = 0; @@ -324,18 +324,18 @@ namespace Lucene.Net.Codecs.Pulsing { if (payloadLength != lastPayloadLength) { - _buffer.WriteVInt((posDelta << 1) | 1); - _buffer.WriteVInt(payloadLength); + _buffer.WriteVInt32((posDelta << 1) | 1); + _buffer.WriteVInt32(payloadLength); lastPayloadLength = payloadLength; } else { - _buffer.WriteVInt(posDelta << 1); + _buffer.WriteVInt32(posDelta << 1); } } else { - _buffer.WriteVInt(posDelta); + _buffer.WriteVInt32(posDelta); } if (_indexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) @@ -345,12 +345,12 @@ namespace Lucene.Net.Codecs.Pulsing var offsetLength = pos.endOffset - pos.startOffset; if (offsetLength != lastOffsetLength) { - _buffer.WriteVInt(offsetDelta << 1 | 1); - _buffer.WriteVInt(offsetLength); + _buffer.WriteVInt32(offsetDelta << 1 | 1); + _buffer.WriteVInt32(offsetLength); } else { - _buffer.WriteVInt(offsetDelta << 1); + _buffer.WriteVInt32(offsetDelta << 1); } lastOffset = pos.startOffset; lastOffsetLength = offsetLength; @@ -378,12 +378,12 @@ namespace Lucene.Net.Codecs.Pulsing if (doc.termFreq == 1) { - _buffer.WriteVInt((delta << 1) | 1); + _buffer.WriteVInt32((delta << 1) | 1); } else { - _buffer.WriteVInt(delta << 1); - _buffer.WriteVInt(doc.termFreq); + _buffer.WriteVInt32(delta << 1); + _buffer.WriteVInt32(doc.termFreq); } lastDocId = doc.docID; } @@ -395,7 +395,7 @@ namespace Lucene.Net.Codecs.Pulsing for (var posIdx = 0; posIdx < _pendingCount; posIdx++) { var doc = _pending[posIdx]; - _buffer.WriteVInt(doc.docID - lastDocId); + _buffer.WriteVInt32(doc.docID - lastDocId); lastDocId = doc.docID; } } @@ -420,7 +420,7 @@ namespace Lucene.Net.Codecs.Pulsing _wrappedPostingsWriter.EncodeTerm(_longs, _buffer, fieldInfo, _state.wrappedState, _absolute); for (var i = 0; i < _longsSize; i++) { - output.WriteVLong(_longs[i]); + output.WriteVInt64(_longs[i]); } _buffer.WriteTo(output); _buffer.Reset(); @@ -428,7 +428,7 @@ namespace Lucene.Net.Codecs.Pulsing } else { - output.WriteVInt(_state.bytes.Length); + output.WriteVInt32(_state.bytes.Length); output.WriteBytes(_state.bytes, 0, _state.bytes.Length); _absolute = _absolute || abs; } @@ -452,11 +452,11 @@ namespace Lucene.Net.Codecs.Pulsing output = _segmentState.Directory.CreateOutput(summaryFileName, _segmentState.Context); CodecUtil.WriteHeader(output, CODEC, VERSION_CURRENT); - output.WriteVInt(_fields.Count); + output.WriteVInt32(_fields.Count); foreach (var field in _fields) { - output.WriteVInt(field.FieldNumber); - output.WriteVInt(field.LongsSize); + output.WriteVInt32(field.FieldNumber); + output.WriteVInt32(field.LongsSize); } output.Dispose(); } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs b/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs index 9226c2e..97f35db 100644 --- a/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs +++ b/src/Lucene.Net.Codecs/Sep/SepPostingsReader.cs @@ -102,9 +102,9 @@ namespace Lucene.Net.Codecs.Sep // Make sure we are talking to the matching past writer CodecUtil.CheckHeader(termsIn, SepPostingsWriter.CODEC, SepPostingsWriter.VERSION_START, SepPostingsWriter.VERSION_START); - _skipInterval = termsIn.ReadInt(); - _maxSkipLevels = termsIn.ReadInt(); - _skipMinimum = termsIn.ReadInt(); + _skipInterval = termsIn.ReadInt32(); + _maxSkipLevels = termsIn.ReadInt32(); + _skipMinimum = termsIn.ReadInt32(); } protected override void Dispose(bool disposing) @@ -215,11 +215,11 @@ namespace Lucene.Net.Codecs.Sep { if (absolute) { - termState.PAYLOAD_FP = input.ReadVLong(); + termState.PAYLOAD_FP = input.ReadVInt64(); } else { - termState.PAYLOAD_FP += input.ReadVLong(); + termState.PAYLOAD_FP += input.ReadVInt64(); } } } @@ -229,11 +229,11 @@ namespace Lucene.Net.Codecs.Sep { if (absolute) { - termState.SKIP_FP = input.ReadVLong(); + termState.SKIP_FP = input.ReadVInt64(); } else { - termState.SKIP_FP += input.ReadVLong(); + termState.SKIP_FP += input.ReadVInt64(); } } else if (absolute) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs b/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs index ff8bfb2..ad2f89f 100644 --- a/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs +++ b/src/Lucene.Net.Codecs/Sep/SepPostingsWriter.cs @@ -158,9 +158,9 @@ namespace Lucene.Net.Codecs.Sep { CodecUtil.WriteHeader(termsOut, CODEC, VERSION_CURRENT); // TODO: -- just ask skipper to "start" here - termsOut.WriteInt(skipInterval); // write skipInterval - termsOut.WriteInt(maxSkipLevels); // write maxSkipLevels - termsOut.WriteInt(skipMinimum); // write skipMinimum + termsOut.WriteInt32(skipInterval); // write skipInterval + termsOut.WriteInt32(maxSkipLevels); // write maxSkipLevels + termsOut.WriteInt32(skipMinimum); // write skipMinimum } public override BlockTermState NewTermState() @@ -377,11 +377,11 @@ namespace Lucene.Net.Codecs.Sep { if (absolute) { - output.WriteVLong(state.PayloadFp); + output.WriteVInt64(state.PayloadFp); } else { - output.WriteVLong(state.PayloadFp - lastPayloadFP); + output.WriteVInt64(state.PayloadFp - lastPayloadFP); } lastPayloadFP = state.PayloadFp; } @@ -391,11 +391,11 @@ namespace Lucene.Net.Codecs.Sep if (absolute) { - output.WriteVLong(state.SkipFp); + output.WriteVInt64(state.SkipFp); } else { - output.WriteVLong(state.SkipFp - lastSkipFP); + output.WriteVInt64(state.SkipFp - lastSkipFP); } lastSkipFP = state.SkipFp; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs b/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs index cfae7df..aa090b5 100644 --- a/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs +++ b/src/Lucene.Net.Codecs/Sep/SepSkipListReader.cs @@ -180,16 +180,16 @@ namespace Lucene.Net.Codecs.Sep // to read the current payload length // because it differs from the length of the // previous payload - delta = skipStream.ReadVInt(); + delta = skipStream.ReadVInt32(); if ((delta & 1) != 0) { - _payloadLength[level] = skipStream.ReadVInt(); + _payloadLength[level] = skipStream.ReadVInt32(); } delta = (int) ((uint) delta >> 1); } else { - delta = skipStream.ReadVInt(); + delta = skipStream.ReadVInt32(); } if (_indexOptions != IndexOptions.DOCS_ONLY) @@ -201,7 +201,7 @@ namespace Lucene.Net.Codecs.Sep _posIndex[level].Read(skipStream, false); if (_currentFieldStoresPayloads) - _payloadPointer[level] += skipStream.ReadVInt(); + _payloadPointer[level] += skipStream.ReadVInt32(); return delta; } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs b/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs index feedd66..6e5bc5c 100644 --- a/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs +++ b/src/Lucene.Net.Codecs/Sep/SepSkipListWriter.cs @@ -179,21 +179,21 @@ namespace Lucene.Net.Codecs.Sep { // the current payload length equals the length at the previous skip point, // so we don't store the length again - skipBuffer.WriteVInt(delta << 1); + skipBuffer.WriteVInt32(delta << 1); } else { // the payload length is different from the previous one. We shift the DocSkip, // set the lowest bit and store the current payload length as VInt. - skipBuffer.WriteVInt(delta << 1 | 1); - skipBuffer.WriteVInt(_curPayloadLength); + skipBuffer.WriteVInt32(delta << 1 | 1); + skipBuffer.WriteVInt32(_curPayloadLength); _lastSkipPayloadLength[level] = _curPayloadLength; } } else { // current field does not store payloads - skipBuffer.WriteVInt(_curDoc - _lastSkipDoc[level]); + skipBuffer.WriteVInt32(_curDoc - _lastSkipDoc[level]); } if (_indexOptions != IndexOptions.DOCS_ONLY) @@ -209,7 +209,7 @@ namespace Lucene.Net.Codecs.Sep _posIndex[level].Write(skipBuffer, false); if (_curStorePayloads) { - skipBuffer.WriteVInt((int)(_curPayloadPointer - _lastSkipPayloadPointer[level])); + skipBuffer.WriteVInt32((int)(_curPayloadPointer - _lastSkipPayloadPointer[level])); } } http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs index 5c2398c..fbe26ba 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextFieldsReader.cs @@ -303,7 +303,7 @@ namespace Lucene.Net.Codecs.SimpleText } UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.DOC.Length, _scratch.Length - SimpleTextFieldsWriter.DOC.Length, _scratchUtf16); - _docId = ArrayUtil.ParseInt(_scratchUtf16.Chars, 0, _scratchUtf16.Length); + _docId = ArrayUtil.ParseInt32(_scratchUtf16.Chars, 0, _scratchUtf16.Length); termFreq = 0; first = false; } @@ -311,7 +311,7 @@ namespace Lucene.Net.Codecs.SimpleText { UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.FREQ.Length, _scratch.Length - SimpleTextFieldsWriter.FREQ.Length, _scratchUtf16); - termFreq = ArrayUtil.ParseInt(_scratchUtf16.Chars, 0, _scratchUtf16.Length); + termFreq = ArrayUtil.ParseInt32(_scratchUtf16.Chars, 0, _scratchUtf16.Length); } else if (StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.POS)) { @@ -437,7 +437,7 @@ namespace Lucene.Net.Codecs.SimpleText } UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.DOC.Length, _scratch.Length - SimpleTextFieldsWriter.DOC.Length, _scratchUtf16); - _docId = ArrayUtil.ParseInt(_scratchUtf16.Chars, 0, _scratchUtf16.Length); + _docId = ArrayUtil.ParseInt32(_scratchUtf16.Chars, 0, _scratchUtf16.Length); _tf = 0; first = false; } @@ -445,7 +445,7 @@ namespace Lucene.Net.Codecs.SimpleText { UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.FREQ.Length, _scratch.Length - SimpleTextFieldsWriter.FREQ.Length, _scratchUtf16); - _tf = ArrayUtil.ParseInt(_scratchUtf16.Chars, 0, _scratchUtf16.Length); + _tf = ArrayUtil.ParseInt32(_scratchUtf16.Chars, 0, _scratchUtf16.Length); posStart = _in.FilePointer; } else if (StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.POS)) @@ -495,7 +495,7 @@ namespace Lucene.Net.Codecs.SimpleText Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.POS), "got line=" + _scratch.Utf8ToString()); UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.POS.Length, _scratch.Length - SimpleTextFieldsWriter.POS.Length, _scratchUtf162); - pos = ArrayUtil.ParseInt(_scratchUtf162.Chars, 0, _scratchUtf162.Length); + pos = ArrayUtil.ParseInt32(_scratchUtf162.Chars, 0, _scratchUtf162.Length); } else { @@ -508,12 +508,12 @@ namespace Lucene.Net.Codecs.SimpleText Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.START_OFFSET), "got line=" + _scratch.Utf8ToString()); UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.START_OFFSET.Length, _scratch.Length - SimpleTextFieldsWriter.START_OFFSET.Length, _scratchUtf162); - _startOffset = ArrayUtil.ParseInt(_scratchUtf162.Chars, 0, _scratchUtf162.Length); + _startOffset = ArrayUtil.ParseInt32(_scratchUtf162.Chars, 0, _scratchUtf162.Length); SimpleTextUtil.ReadLine(_in, _scratch); Debug.Assert(StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.END_OFFSET), "got line=" + _scratch.Utf8ToString()); UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.END_OFFSET.Length, _scratch.Length - SimpleTextFieldsWriter.END_OFFSET.Length, _scratchUtf162); - _endOffset = ArrayUtil.ParseInt(_scratchUtf162.Chars, 0, _scratchUtf162.Length); + _endOffset = ArrayUtil.ParseInt32(_scratchUtf162.Chars, 0, _scratchUtf162.Length); } long fp = _in.FilePointer; @@ -619,7 +619,7 @@ namespace Lucene.Net.Codecs.SimpleText { if (lastDocsStart != -1) { - b.Add(Util.ToIntsRef(lastTerm, scratchIntsRef), + b.Add(Util.ToInt32sRef(lastTerm, scratchIntsRef), outputs.NewPair(lastDocsStart, outputsInner.NewPair(docFreq, totalTermFreq))); _sumTotalTermFreq += totalTermFreq; } @@ -632,20 +632,20 @@ namespace Lucene.Net.Codecs.SimpleText _sumDocFreq++; UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.DOC.Length, _scratch.Length - SimpleTextFieldsWriter.DOC.Length, _scratchUtf16); - int docId = ArrayUtil.ParseInt(_scratchUtf16.Chars, 0, _scratchUtf16.Length); + int docId = ArrayUtil.ParseInt32(_scratchUtf16.Chars, 0, _scratchUtf16.Length); visitedDocs.Set(docId); } else if (StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.FREQ)) { UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + SimpleTextFieldsWriter.FREQ.Length, _scratch.Length - SimpleTextFieldsWriter.FREQ.Length, _scratchUtf16); - totalTermFreq += ArrayUtil.ParseInt(_scratchUtf16.Chars, 0, _scratchUtf16.Length); + totalTermFreq += ArrayUtil.ParseInt32(_scratchUtf16.Chars, 0, _scratchUtf16.Length); } else if (StringHelper.StartsWith(_scratch, SimpleTextFieldsWriter.TERM)) { if (lastDocsStart != -1) { - b.Add(Util.ToIntsRef(lastTerm, scratchIntsRef), + b.Add(Util.ToInt32sRef(lastTerm, scratchIntsRef), outputs.NewPair(lastDocsStart, outputsInner.NewPair(docFreq, totalTermFreq))); } lastDocsStart = input.FilePointer; http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/SimpleText/SimpleTextLiveDocsFormat.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextLiveDocsFormat.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextLiveDocsFormat.cs index bd1d709..439049f 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextLiveDocsFormat.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextLiveDocsFormat.cs @@ -115,7 +115,7 @@ namespace Lucene.Net.Codecs.SimpleText private int ParseIntAt(BytesRef bytes, int offset, CharsRef scratch) // LUCENENET TODO: Rename ParseInt32At ? { UnicodeUtil.UTF8toUTF16(bytes.Bytes, bytes.Offset + offset, bytes.Length - offset, scratch); - return ArrayUtil.ParseInt(scratch.Chars, 0, scratch.Length); + return ArrayUtil.ParseInt32(scratch.Chars, 0, scratch.Length); } public override void WriteLiveDocs(IMutableBits bits, Directory dir, SegmentCommitInfo info, int newDelCount, http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs index d40d03a..335a23c 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextStoredFieldsReader.cs @@ -252,7 +252,7 @@ namespace Lucene.Net.Codecs.SimpleText private int ParseIntAt(int offset) // LUCENENET TODO: Rename ParseInt32At { UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + offset, _scratch.Length - offset, _scratchUtf16); - return ArrayUtil.ParseInt(_scratchUtf16.Chars, 0, _scratchUtf16.Length); + return ArrayUtil.ParseInt32(_scratchUtf16.Chars, 0, _scratchUtf16.Length); } private bool EqualsAt(BytesRef a, BytesRef b, int bOffset) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs index 1fd43bd..82c877d 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextTermVectorsReader.cs @@ -260,7 +260,7 @@ namespace Lucene.Net.Codecs.SimpleText private int ParseIntAt(int offset) // LUCENENET TODO: Rename ParseInt32At ? { UnicodeUtil.UTF8toUTF16(_scratch.Bytes, _scratch.Offset + offset, _scratch.Length - offset, _scratchUtf16); - return ArrayUtil.ParseInt(_scratchUtf16.Chars, 0, _scratchUtf16.Length); + return ArrayUtil.ParseInt32(_scratchUtf16.Chars, 0, _scratchUtf16.Length); } private string ReadString(int offset, BytesRef scratch) http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f7432173/src/Lucene.Net.Core/Analysis/NumericTokenStream.cs ---------------------------------------------------------------------- diff --git a/src/Lucene.Net.Core/Analysis/NumericTokenStream.cs b/src/Lucene.Net.Core/Analysis/NumericTokenStream.cs index a6b75f9..039c171 100644 --- a/src/Lucene.Net.Core/Analysis/NumericTokenStream.cs +++ b/src/Lucene.Net.Core/Analysis/NumericTokenStream.cs @@ -178,11 +178,11 @@ namespace Lucene.Net.Analysis Debug.Assert(ValueSize == 64 || ValueSize == 32); if (ValueSize == 64) { - NumericUtils.LongToPrefixCoded(_value, Shift, _bytes); + NumericUtils.Int64ToPrefixCoded(_value, Shift, _bytes); } else { - NumericUtils.IntToPrefixCoded((int)_value, Shift, _bytes); + NumericUtils.Int32ToPrefixCoded((int)_value, Shift, _bytes); } } @@ -275,22 +275,28 @@ namespace Lucene.Net.Analysis } /// <summary> - /// Initializes the token stream with the supplied <code>long</code> value. </summary> + /// Initializes the token stream with the supplied <code>long</code> value. + /// <para/> + /// NOTE: This was setLongValue() in Lucene + /// </summary> /// <param name="value"> the value, for which this TokenStream should enumerate tokens. </param> /// <returns> this instance, because of this you can use it the following way: /// <code>new Field(name, new NumericTokenStream(precisionStep).setLongValue(value))</code> </returns> - public NumericTokenStream SetLongValue(long value) + public NumericTokenStream SetInt64Value(long value) { numericAtt.Init(value, valSize = 64, precisionStep, -precisionStep); return this; } /// <summary> - /// Initializes the token stream with the supplied <code>int</code> value. </summary> + /// Initializes the token stream with the supplied <code>int</code> value. + /// <para/> + /// NOTE: This was setIntValue() in Lucene + /// </summary> /// <param name="value"> the value, for which this TokenStream should enumerate tokens. </param> /// <returns> this instance, because of this you can use it the following way: /// <code>new Field(name, new NumericTokenStream(precisionStep).setIntValue(value))</code> </returns> - public NumericTokenStream SetIntValue(int value) + public NumericTokenStream SetInt32Value(int value) { numericAtt.Init(value, valSize = 32, precisionStep, -precisionStep); return this; @@ -303,18 +309,21 @@ namespace Lucene.Net.Analysis /// <code>new Field(name, new NumericTokenStream(precisionStep).setDoubleValue(value))</code> </returns> public NumericTokenStream SetDoubleValue(double value) { - numericAtt.Init(NumericUtils.DoubleToSortableLong(value), valSize = 64, precisionStep, -precisionStep); + numericAtt.Init(NumericUtils.DoubleToSortableInt64(value), valSize = 64, precisionStep, -precisionStep); return this; } /// <summary> - /// Initializes the token stream with the supplied <code>float</code> value. </summary> + /// Initializes the token stream with the supplied <code>float</code> value. + /// <para/> + /// NOTE: This was setFloatValue() in Lucene + /// </summary> /// <param name="value"> the value, for which this TokenStream should enumerate tokens. </param> /// <returns> this instance, because of this you can use it the following way: /// <code>new Field(name, new NumericTokenStream(precisionStep).setFloatValue(value))</code> </returns> - public NumericTokenStream SetFloatValue(float value) + public NumericTokenStream SetSingleValue(float value) { - numericAtt.Init(NumericUtils.FloatToSortableInt(value), valSize = 32, precisionStep, -precisionStep); + numericAtt.Init(NumericUtils.SingleToSortableInt32(value), valSize = 32, precisionStep, -precisionStep); return this; }
