LUCENE-5922: DocValuesDocIdSet is not cacheable.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1623345 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2014-09-08 09:59:35 +00:00
parent ea365a6a96
commit 190fd083a3
3 changed files with 6 additions and 11 deletions

View File

@ -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

View File

@ -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;

View File

@ -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