for (int i = 0; i < values.size(); ++i) {
Document doc = new Document();
id.setStringValue("" + i);
doc.add(id);
final LongOpenHashSet v = values.get(i);
final boolean[] states = v.allocated;
final long[] keys = v.keys;
for (int j = 0; j < states.length; j++) {
if (states[j]) {
LongField value = new LongField("value", keys[j], Field.Store.NO);
doc.add(value);
}
}
writer.addDocument(doc);
}
writer.forceMerge(1, true);
final IndexNumericFieldData indexFieldData = getForField("value");
final AtomicNumericFieldData atomicFieldData = indexFieldData.load(refreshReader());
final SortedNumericDocValues data = atomicFieldData.getLongValues();
final SortedNumericDoubleValues doubleData = atomicFieldData.getDoubleValues();
final LongOpenHashSet set = new LongOpenHashSet();
final DoubleOpenHashSet doubleSet = new DoubleOpenHashSet();
for (int i = 0; i < values.size(); ++i) {
final LongOpenHashSet v = values.get(i);
data.setDocument(i);
assertThat(data.count() > 0, equalTo(!v.isEmpty()));
doubleData.setDocument(i);
assertThat(doubleData.count() > 0, equalTo(!v.isEmpty()));
set.clear();
data.setDocument(i);
int numValues = data.count();
for (int j = 0; j < numValues; j++) {