mirror of https://github.com/apache/lucene.git
LUCENE-8374 part 4/4: Reduce reads for sparse DocValues
Offset and index jump-table for norm blocks.
This commit is contained in:
parent
7949b98f80
commit
e356d793ca
|
@ -45,6 +45,7 @@ final class Lucene70NormsProducer extends NormsProducer implements Cloneable {
|
||||||
private final Map<Integer,NormsEntry> norms = new HashMap<>();
|
private final Map<Integer,NormsEntry> norms = new HashMap<>();
|
||||||
private final int maxDoc;
|
private final int maxDoc;
|
||||||
private IndexInput data;
|
private IndexInput data;
|
||||||
|
private final IndexedDISICacheFactory disiCacheFactory = new IndexedDISICacheFactory();
|
||||||
private boolean merging;
|
private boolean merging;
|
||||||
private Map<Integer, IndexInput> disiInputs;
|
private Map<Integer, IndexInput> disiInputs;
|
||||||
private Map<Integer, RandomAccessInput> dataInputs;
|
private Map<Integer, RandomAccessInput> dataInputs;
|
||||||
|
@ -293,7 +294,9 @@ final class Lucene70NormsProducer extends NormsProducer implements Cloneable {
|
||||||
} else {
|
} else {
|
||||||
// sparse
|
// sparse
|
||||||
final IndexInput disiInput = getDisiInput(field, entry);
|
final IndexInput disiInput = getDisiInput(field, entry);
|
||||||
final IndexedDISI disi = new IndexedDISI(disiInput, entry.numDocsWithField);
|
final IndexedDISI disi = disiCacheFactory.createCachedIndexedDISI(
|
||||||
|
disiInput, entry.docsWithFieldOffset + entry.docsWithFieldLength, entry.numDocsWithField, field.name);
|
||||||
|
|
||||||
if (entry.bytesPerNorm == 0) {
|
if (entry.bytesPerNorm == 0) {
|
||||||
return new SparseNormsIterator(disi) {
|
return new SparseNormsIterator(disi) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -342,11 +345,12 @@ final class Lucene70NormsProducer extends NormsProducer implements Cloneable {
|
||||||
@Override
|
@Override
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
data.close();
|
data.close();
|
||||||
|
disiCacheFactory.releaseAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long ramBytesUsed() {
|
public long ramBytesUsed() {
|
||||||
return 64L * norms.size(); // good enough
|
return 64L * norms.size() + disiCacheFactory.ramBytesUsed(); // good enough
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue