Skip to content

Apache Lucene open-source search software

LUCENE-5922: DocValuesDocIdSet is not cacheable.

Adrien Grand190fd083a396
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 66dc6f2d424..9b307e73f94 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -145,6 +145,9 @@ Bug Fixes
possibly deleting a file that's still in use in the index, leading
to corruption. (Mike McCandless)
+* LUCENE-5922: DocValuesDocIdSet on 5.x and FieldCacheDocIdSet on 4.x
+ are not cacheable. (Adrien Grand)
+
Build
* LUCENE-5909: Smoke tester now has better command line parsing and
diff --git a/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java b/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java
index b13cdc0ec98..bf67f2d15e4 100644
--- a/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java
+++ b/lucene/core/src/java/org/apache/lucene/search/DocValuesDocIdSet.java
@@ -46,15 +46,6 @@ public abstract class DocValuesDocIdSet extends DocIdSet {
*/
protected abstract boolean matchDoc(int doc);
- /**
- * this DocIdSet is always cacheable (does not go back
- * to the reader for iteration)
- */
- @Override
- public final boolean isCacheable() {
- return true;
- }
-
@Override
public long ramBytesUsed() {
return 0L;
diff --git a/lucene/core/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java b/lucene/core/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
index d2e4433ee8d..4955ece090f 100644
--- a/lucene/core/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
+++ b/lucene/core/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
@@ -35,6 +35,7 @@ import org.apache.lucene.util.Bits;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.IOUtils;
import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.WAH8DocIdSet;
public class TestCachingWrapperFilter extends LuceneTestCase {
Directory dir;
@@ -240,7 +241,7 @@ public class TestCachingWrapperFilter extends LuceneTestCase {
if (originalSet.isCacheable()) {
assertEquals("Cached DocIdSet must be of same class like uncached, if cacheable", originalSet.getClass(), cachedSet.getClass());
} else {
- assertTrue("Cached DocIdSet must be an FixedBitSet if the original one was not cacheable", cachedSet instanceof FixedBitSet || cachedSet == null);
+ assertTrue("Cached DocIdSet must be an WAH8DocIdSet if the original one was not cacheable", cachedSet instanceof WAH8DocIdSet || cachedSet == null);
}
}
}
@@ -258,7 +259,7 @@ public class TestCachingWrapperFilter extends LuceneTestCase {
// returns default empty docidset, always cacheable:
assertDocIdSetCacheable(reader, NumericRangeFilter.newIntRange("test", Integer.valueOf(10000), Integer.valueOf(-10000), true, true), true);
// is cacheable:
- assertDocIdSetCacheable(reader, DocValuesRangeFilter.newIntRange("test", Integer.valueOf(10), Integer.valueOf(20), true, true), true);
+ assertDocIdSetCacheable(reader, DocValuesRangeFilter.newIntRange("test", Integer.valueOf(10), Integer.valueOf(20), true, true), false);
// a fixedbitset filter is always cacheable
assertDocIdSetCacheable(reader, new Filter() {
@Override