LUCENE-1536: avoid needless checking of livedocs for solr DocSets

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1239432 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-02-02 01:37:50 +00:00
parent fa11c89517
commit 49799e031f
3 changed files with 16 additions and 7 deletions

View File

@ -17,6 +17,7 @@
package org.apache.solr.search;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.search.BitsFilteredDocIdSet;
@ -249,7 +250,9 @@ public class BitDocSet extends DocSetBase {
return new Filter() {
@Override
public DocIdSet getDocIdSet(final AtomicReaderContext context, final Bits acceptDocs) throws IOException {
IndexReader reader = context.reader();
AtomicReader reader = context.reader();
// all Solr DocSets that are used as filters only include live docs
final Bits acceptDocs2 = acceptDocs == null ? null : (reader.getLiveDocs() == acceptDocs ? null : acceptDocs);
if (context.isTopLevel) {
return BitsFilteredDocIdSet.wrap(bs, acceptDocs);
@ -306,7 +309,7 @@ public class BitDocSet extends DocSetBase {
};
}
}, acceptDocs);
}, acceptDocs2);
}
};
}

View File

@ -17,6 +17,7 @@
package org.apache.solr.search;
import org.apache.lucene.index.AtomicReader;
import org.apache.solr.common.SolrException;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.OpenBitSet;
@ -272,8 +273,10 @@ abstract class DocSetBase implements DocSet {
return new Filter() {
@Override
public DocIdSet getDocIdSet(final AtomicReaderContext context, final Bits acceptDocs) throws IOException {
IndexReader reader = context.reader();
public DocIdSet getDocIdSet(final AtomicReaderContext context, Bits acceptDocs) throws IOException {
AtomicReader reader = context.reader();
// all Solr DocSets that are used as filters only include live docs
final Bits acceptDocs2 = acceptDocs == null ? null : (reader.getLiveDocs() == acceptDocs ? null : acceptDocs);
if (context.isTopLevel) {
return BitsFilteredDocIdSet.wrap(bs, acceptDocs);
@ -321,7 +324,7 @@ abstract class DocSetBase implements DocSet {
return null;
}
}, acceptDocs);
}, acceptDocs2);
}
};
}

View File

@ -17,6 +17,7 @@
package org.apache.solr.search;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.OpenBitSet;
import org.apache.lucene.search.BitsFilteredDocIdSet;
@ -658,7 +659,9 @@ public class SortedIntDocSet extends DocSetBase {
@Override
public DocIdSet getDocIdSet(final AtomicReaderContext context, final Bits acceptDocs) throws IOException {
IndexReader reader = context.reader();
AtomicReader reader = context.reader();
// all Solr DocSets that are used as filters only include live docs
final Bits acceptDocs2 = acceptDocs == null ? null : (reader.getLiveDocs() == acceptDocs ? null : acceptDocs);
final int base = context.docBase;
final int maxDoc = reader.maxDoc();
@ -759,7 +762,7 @@ public class SortedIntDocSet extends DocSetBase {
return null;
}
}, acceptDocs);
}, acceptDocs2);
}
};
}