SOLR-1965: use fastGet in BitDocSet to speed up intersection counts

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@956110 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-06-18 19:53:08 +00:00
parent 6f6dd9763e
commit cda18f0bd6
2 changed files with 5 additions and 2 deletions

View File

@ -140,8 +140,11 @@ public class BitDocSet extends DocSetBase {
size=-1;
}
/** Returns true of the doc exists in the set.
* Should only be called when doc < OpenBitSet.size()
*/
public boolean exists(int doc) {
return bits.get(doc);
return bits.fastGet(doc);
}
@Override

View File

@ -108,7 +108,7 @@ public class TestDocSet extends TestCase {
}
public void checkEqual(OpenBitSet bs, DocSet set) {
for (int i=0; i<bs.capacity(); i++) {
for (int i=0; i<set.size(); i++) {
assertEquals(bs.get(i), set.exists(i));
}
assertEquals(bs.cardinality(), set.size());