mirror of https://github.com/apache/lucene.git
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:
parent
2bccce2777
commit
7e02f0fb4b
|
@ -39,7 +39,7 @@ import org.apache.lucene.index.TermsEnum;
|
||||||
import org.apache.lucene.util.ArrayUtil;
|
import org.apache.lucene.util.ArrayUtil;
|
||||||
import org.apache.lucene.util.Bits;
|
import org.apache.lucene.util.Bits;
|
||||||
import org.apache.lucene.util.BytesRef;
|
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
|
* Abstract API that consumes numeric, binary and
|
||||||
|
@ -271,7 +271,7 @@ public abstract class DocValuesConsumer implements Closeable {
|
||||||
if (liveDocs == null) {
|
if (liveDocs == null) {
|
||||||
liveTerms[sub] = new SortedDocValuesTermsEnum(dv);
|
liveTerms[sub] = new SortedDocValuesTermsEnum(dv);
|
||||||
} else {
|
} else {
|
||||||
FixedBitSet bitset = new FixedBitSet(dv.getValueCount());
|
OpenBitSet bitset = new OpenBitSet(dv.getValueCount());
|
||||||
for (int i = 0; i < reader.maxDoc(); i++) {
|
for (int i = 0; i < reader.maxDoc(); i++) {
|
||||||
if (liveDocs.get(i)) {
|
if (liveDocs.get(i)) {
|
||||||
bitset.set(dv.getOrd(i));
|
bitset.set(dv.getOrd(i));
|
||||||
|
@ -403,17 +403,13 @@ public abstract class DocValuesConsumer implements Closeable {
|
||||||
if (liveDocs == null) {
|
if (liveDocs == null) {
|
||||||
liveTerms[sub] = new SortedSetDocValuesTermsEnum(dv);
|
liveTerms[sub] = new SortedSetDocValuesTermsEnum(dv);
|
||||||
} else {
|
} else {
|
||||||
// nocommit: need a "pagedbits"
|
OpenBitSet bitset = new OpenBitSet(dv.getValueCount());
|
||||||
if (dv.getValueCount() > Integer.MAX_VALUE) {
|
|
||||||
throw new UnsupportedOperationException();
|
|
||||||
}
|
|
||||||
FixedBitSet bitset = new FixedBitSet((int)dv.getValueCount());
|
|
||||||
for (int i = 0; i < reader.maxDoc(); i++) {
|
for (int i = 0; i < reader.maxDoc(); i++) {
|
||||||
if (liveDocs.get(i)) {
|
if (liveDocs.get(i)) {
|
||||||
dv.setDocument(i);
|
dv.setDocument(i);
|
||||||
long ord;
|
long ord;
|
||||||
while ((ord = dv.nextOrd()) != SortedSetDocValues.NO_MORE_ORDS) {
|
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 {
|
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!!!!!!!!!!!!!
|
super(in, false); // <-- not passing false here wasted about 3 hours of my time!!!!!!!!!!!!!
|
||||||
assert liveTerms != null;
|
assert liveTerms != null;
|
||||||
this.liveTerms = liveTerms;
|
this.liveTerms = liveTerms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AcceptStatus accept(BytesRef term) throws IOException {
|
protected AcceptStatus accept(BytesRef term) throws IOException {
|
||||||
if (liveTerms.get((int) ord())) {
|
if (liveTerms.get(ord())) {
|
||||||
return AcceptStatus.YES;
|
return AcceptStatus.YES;
|
||||||
} else {
|
} else {
|
||||||
return AcceptStatus.NO;
|
return AcceptStatus.NO;
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.apache.lucene.util.Bits;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.CommandLineUtil;
|
import org.apache.lucene.util.CommandLineUtil;
|
||||||
import org.apache.lucene.util.FixedBitSet;
|
import org.apache.lucene.util.FixedBitSet;
|
||||||
|
import org.apache.lucene.util.OpenBitSet;
|
||||||
import org.apache.lucene.util.StringHelper;
|
import org.apache.lucene.util.StringHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1335,8 +1336,7 @@ public class CheckIndex {
|
||||||
|
|
||||||
private static void checkSortedSetDocValues(String fieldName, AtomicReader reader, SortedSetDocValues dv) {
|
private static void checkSortedSetDocValues(String fieldName, AtomicReader reader, SortedSetDocValues dv) {
|
||||||
final long maxOrd = dv.getValueCount()-1;
|
final long maxOrd = dv.getValueCount()-1;
|
||||||
// nocommit
|
OpenBitSet seenOrds = new OpenBitSet(dv.getValueCount());
|
||||||
FixedBitSet seenOrds = new FixedBitSet((int)dv.getValueCount());
|
|
||||||
long maxOrd2 = -1;
|
long maxOrd2 = -1;
|
||||||
for (int i = 0; i < reader.maxDoc(); i++) {
|
for (int i = 0; i < reader.maxDoc(); i++) {
|
||||||
dv.setDocument(i);
|
dv.setDocument(i);
|
||||||
|
@ -1351,8 +1351,7 @@ public class CheckIndex {
|
||||||
}
|
}
|
||||||
lastOrd = ord;
|
lastOrd = ord;
|
||||||
maxOrd2 = Math.max(maxOrd2, ord);
|
maxOrd2 = Math.max(maxOrd2, ord);
|
||||||
// nocommit
|
seenOrds.set(ord);
|
||||||
seenOrds.set((int)ord);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (maxOrd != maxOrd2) {
|
if (maxOrd != maxOrd2) {
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.apache.lucene.index.SortedDocValues;
|
||||||
import org.apache.lucene.index.SortedSetDocValues;
|
import org.apache.lucene.index.SortedSetDocValues;
|
||||||
import org.apache.lucene.util.BytesRef;
|
import org.apache.lucene.util.BytesRef;
|
||||||
import org.apache.lucene.util.FixedBitSet;
|
import org.apache.lucene.util.FixedBitSet;
|
||||||
|
import org.apache.lucene.util.OpenBitSet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just like {@link Lucene42DocValuesFormat} but with additional asserts.
|
* Just like {@link Lucene42DocValuesFormat} but with additional asserts.
|
||||||
|
@ -144,8 +145,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {
|
||||||
|
|
||||||
int docCount = 0;
|
int docCount = 0;
|
||||||
long ordCount = 0;
|
long ordCount = 0;
|
||||||
// nocommit
|
OpenBitSet seenOrds = new OpenBitSet(valueCount);
|
||||||
FixedBitSet seenOrds = new FixedBitSet((int)valueCount);
|
|
||||||
Iterator<Number> ordIterator = ords.iterator();
|
Iterator<Number> ordIterator = ords.iterator();
|
||||||
for (Number v : docToOrdCount) {
|
for (Number v : docToOrdCount) {
|
||||||
assert v != null;
|
assert v != null;
|
||||||
|
@ -161,7 +161,7 @@ public class AssertingDocValuesFormat extends DocValuesFormat {
|
||||||
long ord = o.longValue();
|
long ord = o.longValue();
|
||||||
assert ord >= 0 && ord < valueCount;
|
assert ord >= 0 && ord < valueCount;
|
||||||
assert ord > lastOrd : "ord=" + ord + ",lastOrd=" + lastOrd;
|
assert ord > lastOrd : "ord=" + ord + ",lastOrd=" + lastOrd;
|
||||||
seenOrds.set((int)ord); // nocommit
|
seenOrds.set(ord);
|
||||||
lastOrd = ord;
|
lastOrd = ord;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue