From c9a7bb26ba01fee29e539ee873d03c51130326b9 Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Fri, 6 Sep 2013 18:22:52 +0200 Subject: [PATCH] Remember to think about filter caching when upgrading to Lucene 4.5. --- .../org/elasticsearch/common/lucene/docset/DocIdSets.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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;