fix computation of ram bytes used in bloom filter posting format

This commit is contained in:
Shay Banon 2013-12-18 22:01:15 +01:00
parent 7969a719f7
commit 0a016716ed
1 changed files with 5 additions and 5 deletions

View File

@ -27,8 +27,6 @@ import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.RamUsageEstimator;
import org.apache.lucene.util.automaton.CompiledAutomaton;
import org.elasticsearch.common.util.BloomFilter; import org.elasticsearch.common.util.BloomFilter;
import java.io.IOException; import java.io.IOException;
@ -184,10 +182,12 @@ public final class BloomFilterPostingsFormat extends PostingsFormat {
@Override @Override
public long ramBytesUsed() { public long ramBytesUsed() {
return RamUsageEstimator.sizeOf(this); long size = delegateFieldsProducer.ramBytesUsed();
for (BloomFilter bloomFilter : bloomsByFieldName.values()) {
size += bloomFilter.getSizeInBytes();
}
return size;
} }
} }
public static final class BloomFilteredTerms extends FilterAtomicReader.FilterTerms { public static final class BloomFilteredTerms extends FilterAtomicReader.FilterTerms {