nuke these nocommits by using openbitset

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene4765@1446411 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2013-02-15 00:25:49 +00:00
parent 2bccce2777
commit 7e02f0fb4b
3 changed files with 15 additions and 20 deletions

View File

@ -39,7 +39,7 @@ import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.util.ArrayUtil;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.OpenBitSet;
/**
* Abstract API that consumes numeric, binary and
@ -271,7 +271,7 @@ public abstract class DocValuesConsumer implements Closeable {
if (liveDocs == null) {
liveTerms[sub] = new SortedDocValuesTermsEnum(dv);
} else {
FixedBitSet bitset = new FixedBitSet(dv.getValueCount());
OpenBitSet bitset = new OpenBitSet(dv.getValueCount());
for (int i = 0; i < reader.maxDoc(); i++) {
if (liveDocs.get(i)) {
bitset.set(dv.getOrd(i));
@ -403,17 +403,13 @@ public abstract class DocValuesConsumer implements Closeable {
if (liveDocs == null) {
liveTerms[sub] = new SortedSetDocValuesTermsEnum(dv);
} else {
// nocommit: need a "pagedbits"
if (dv.getValueCount() > Integer.MAX_VALUE) {
throw new UnsupportedOperationException();
}
FixedBitSet bitset = new FixedBitSet((int)dv.getValueCount());
OpenBitSet bitset = new OpenBitSet(dv.getValueCount());
for (int i = 0; i < reader.maxDoc(); i++) {
if (liveDocs.get(i)) {
dv.setDocument(i);
long ord;
while ((ord = dv.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
bitset.set((int)ord); // nocommit
bitset.set(ord);
}
}
}
@ -610,19 +606,19 @@ public abstract class DocValuesConsumer implements Closeable {
);
}
// nocommit: need a "pagedbits"
// TODO: seek-by-ord to nextSetBit
static class BitsFilteredTermsEnum extends FilteredTermsEnum {
final Bits liveTerms;
final OpenBitSet liveTerms;
BitsFilteredTermsEnum(TermsEnum in, Bits liveTerms) {
BitsFilteredTermsEnum(TermsEnum in, OpenBitSet liveTerms) {
super(in, false); // <-- not passing false here wasted about 3 hours of my time!!!!!!!!!!!!!
assert liveTerms != null;
this.liveTerms = liveTerms;
}
@Override
protected AcceptStatus accept(BytesRef term) throws IOException {
if (liveTerms.get((int) ord())) {
if (liveTerms.get(ord())) {
return AcceptStatus.YES;
} else {
return AcceptStatus.NO;

View File

@ -42,6 +42,7 @@ import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.CommandLineUtil;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.OpenBitSet;
import org.apache.lucene.util.StringHelper;
/**
@ -1335,8 +1336,7 @@ public class CheckIndex {
private static void checkSortedSetDocValues(String fieldName, AtomicReader reader, SortedSetDocValues dv) {
final long maxOrd = dv.getValueCount()-1;
// nocommit
FixedBitSet seenOrds = new FixedBitSet((int)dv.getValueCount());
OpenBitSet seenOrds = new OpenBitSet(dv.getValueCount());
long maxOrd2 = -1;
for (int i = 0; i < reader.maxDoc(); i++) {
dv.setDocument(i);
@ -1351,8 +1351,7 @@ public class CheckIndex {
}
lastOrd = ord;
maxOrd2 = Math.max(maxOrd2, ord);
// nocommit
seenOrds.set((int)ord);
seenOrds.set(ord);
}
}
if (maxOrd != maxOrd2) {

View File

@ -35,6 +35,7 @@ import org.apache.lucene.index.SortedDocValues;
import org.apache.lucene.index.SortedSetDocValues;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.FixedBitSet;
import org.apache.lucene.util.OpenBitSet;
/**
* Just like {@link Lucene42DocValuesFormat} but with additional asserts.
@ -144,8 +145,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {
int docCount = 0;
long ordCount = 0;
// nocommit
FixedBitSet seenOrds = new FixedBitSet((int)valueCount);
OpenBitSet seenOrds = new OpenBitSet(valueCount);
Iterator<Number> ordIterator = ords.iterator();
for (Number v : docToOrdCount) {
assert v != null;
@ -161,7 +161,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {
long ord = o.longValue();
assert ord >= 0 && ord < valueCount;
assert ord > lastOrd : "ord=" + ord + ",lastOrd=" + lastOrd;
seenOrds.set((int)ord); // nocommit
seenOrds.set(ord);
lastOrd = ord;
}
}