Skip to content

Commit

Permalink
Remember to think about filter caching when upgrading to Lucene 4.5.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz committed Sep 6, 2013
1 parent 8203d4d commit c9a7bb2
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,22 @@
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;

/**
*/
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;
Expand Down

0 comments on commit c9a7bb2

Please sign in to comment.