diff --git a/src/main/java/org/elasticsearch/common/lucene/docset/DocIdSets.java b/src/main/java/org/elasticsearch/common/lucene/docset/DocIdSets.java index 84180056ee0..003840c41d2 100644 --- a/src/main/java/org/elasticsearch/common/lucene/docset/DocIdSets.java +++ b/src/main/java/org/elasticsearch/common/lucene/docset/DocIdSets.java @@ -25,7 +25,9 @@ import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.util.Bits; import org.apache.lucene.util.FixedBitSet; import org.apache.lucene.util.OpenBitSetIterator; +import org.apache.lucene.util.Version; import org.elasticsearch.common.Nullable; +import org.elasticsearch.common.lucene.Lucene; import java.io.IOException; @@ -33,6 +35,12 @@ import java.io.IOException; */ public class DocIdSets { + static { + // TODO when upgrading to Lucene 4.5. Lucene's CachingWrapperFilter now doesn't use FixedBitSet all the time in favor of + // more memory-efficient implementations. Maybe we should do the same in toCacheable? + assert Version.LUCENE_44.onOrAfter(Lucene.VERSION); + } + public static long sizeInBytes(DocIdSet docIdSet) { if (docIdSet instanceof FixedBitSet) { return ((FixedBitSet) docIdSet).getBits().length * 8 + 16;