Remember to think about filter caching when upgrading to Lucene 4.5.
This commit is contained in:
parent
8203d4dbcf
commit
c9a7bb26ba
|
@ -25,7 +25,9 @@ import org.apache.lucene.search.DocIdSetIterator;
|
||||||
import org.apache.lucene.util.Bits;
|
import org.apache.lucene.util.Bits;
|
||||||
import org.apache.lucene.util.FixedBitSet;
|
import org.apache.lucene.util.FixedBitSet;
|
||||||
import org.apache.lucene.util.OpenBitSetIterator;
|
import org.apache.lucene.util.OpenBitSetIterator;
|
||||||
|
import org.apache.lucene.util.Version;
|
||||||
import org.elasticsearch.common.Nullable;
|
import org.elasticsearch.common.Nullable;
|
||||||
|
import org.elasticsearch.common.lucene.Lucene;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -33,6 +35,12 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public class DocIdSets {
|
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) {
|
public static long sizeInBytes(DocIdSet docIdSet) {
|
||||||
if (docIdSet instanceof FixedBitSet) {
|
if (docIdSet instanceof FixedBitSet) {
|
||||||
return ((FixedBitSet) docIdSet).getBits().length * 8 + 16;
|
return ((FixedBitSet) docIdSet).getBits().length * 8 + 16;
|
||||||
|
|
Loading…
Reference in New Issue