mirror of https://github.com/apache/lucene.git
simplify packedints usage for in-ram norms impl
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4547@1433091 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
71e6ea1e24
commit
e4508c59e7
|
@ -133,16 +133,8 @@ class Lucene41SimpleNormsConsumer extends SimpleDVConsumer {
|
|||
|
||||
data.writeLong(minValue);
|
||||
|
||||
FormatAndBits formatAndBits = PackedInts.fastestFormatAndBits(count, bitsPerValue, PackedInts.COMPACT);
|
||||
|
||||
// nocommit: refactor this crap in PackedInts.java
|
||||
// e.g. Header.load()/save() or something rather than how it works now.
|
||||
CodecUtil.writeHeader(data, PackedInts.CODEC_NAME, PackedInts.VERSION_CURRENT);
|
||||
data.writeVInt(bitsPerValue);
|
||||
data.writeVInt(count);
|
||||
data.writeVInt(formatAndBits.format.getId());
|
||||
|
||||
final PackedInts.Writer writer = PackedInts.getWriterNoHeader(data, formatAndBits.format, count, formatAndBits.bitsPerValue, 0);
|
||||
FormatAndBits formatAndBits = PackedInts.fastestFormatAndBits(count, bitsPerValue, PackedInts.COMPACT);
|
||||
final PackedInts.Writer writer = PackedInts.getWriter(data, count, formatAndBits.bitsPerValue, 0);
|
||||
for(Number nv : values) {
|
||||
writer.add(nv.longValue() - minValue);
|
||||
}
|
||||
|
|
|
@ -102,8 +102,7 @@ class Lucene41SimpleNormsProducer extends SimpleDVProducer {
|
|||
}
|
||||
final long minValue = data.readLong();
|
||||
assert minValue == 0;
|
||||
PackedInts.Header header = PackedInts.readHeader(data);
|
||||
final PackedInts.Reader reader = PackedInts.getReaderNoHeader(data, header);
|
||||
final PackedInts.Reader reader = PackedInts.getReader(data);
|
||||
return new NumericDocValues() {
|
||||
@Override
|
||||
public long get(int docID) {
|
||||
|
@ -112,8 +111,7 @@ class Lucene41SimpleNormsProducer extends SimpleDVProducer {
|
|||
};
|
||||
} else {
|
||||
final long minValue = data.readLong();
|
||||
PackedInts.Header header = PackedInts.readHeader(data);
|
||||
final PackedInts.Reader reader = PackedInts.getReaderNoHeader(data, header);
|
||||
final PackedInts.Reader reader = PackedInts.getReader(data);
|
||||
return new NumericDocValues() {
|
||||
@Override
|
||||
public long get(int docID) {
|
||||
|
|
Loading…
Reference in New Issue