clean-up long values
This commit is contained in:
parent
5aedf74fb0
commit
d5c271acf5
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.index.fielddata;
|
||||
|
||||
import org.elasticsearch.ElasticSearchIllegalStateException;
|
||||
import org.elasticsearch.index.fielddata.LongValues.Iter;
|
||||
import org.elasticsearch.index.fielddata.util.DoubleArrayRef;
|
||||
import org.elasticsearch.index.fielddata.util.IntArrayRef;
|
||||
import org.elasticsearch.index.fielddata.util.LongArrayRef;
|
||||
|
@ -136,7 +137,6 @@ public interface DoubleValues {
|
|||
|
||||
private final LongValues values;
|
||||
private final ValueIter iter = new ValueIter();
|
||||
private final Proc proc = new Proc();
|
||||
|
||||
public LongBased(LongValues values) {
|
||||
this.values = values;
|
||||
|
@ -172,7 +172,14 @@ public interface DoubleValues {
|
|||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
values.forEachValueInDoc(docId, this.proc.reset(proc));
|
||||
if (values.hasValue(docId)) {
|
||||
final LongValues.Iter longIter = values.getIter(docId);
|
||||
while(longIter.hasNext()) {
|
||||
proc.onValue(docId, longIter.next());
|
||||
}
|
||||
} else {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
|
||||
static class ValueIter implements Iter {
|
||||
|
@ -195,26 +202,6 @@ public interface DoubleValues {
|
|||
}
|
||||
}
|
||||
|
||||
static class Proc implements LongValues.ValueInDocProc {
|
||||
|
||||
private ValueInDocProc proc;
|
||||
|
||||
private Proc reset(ValueInDocProc proc) {
|
||||
this.proc = proc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValue(int docId, long value) {
|
||||
this.proc.onValue(docId, (double) value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMissing(int docId) {
|
||||
this.proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class FilteredDoubleValues implements DoubleValues {
|
||||
|
|
|
@ -20,46 +20,116 @@
|
|||
package org.elasticsearch.index.fielddata;
|
||||
|
||||
import org.elasticsearch.ElasticSearchIllegalStateException;
|
||||
import org.elasticsearch.index.fielddata.util.LongArrayRef;
|
||||
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
|
||||
import org.elasticsearch.index.fielddata.ordinals.Ordinals.Docs;
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface LongValues {
|
||||
public abstract class LongValues {
|
||||
|
||||
static final LongValues EMPTY = new Empty();
|
||||
public static final LongValues EMPTY = new Empty();
|
||||
private final boolean multiValued;
|
||||
protected final Iter.Single iter = new Iter.Single();
|
||||
|
||||
|
||||
protected LongValues(boolean multiValued) {
|
||||
this.multiValued = multiValued;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is one of the documents in this field data values is multi valued?
|
||||
*/
|
||||
boolean isMultiValued();
|
||||
public final boolean isMultiValued() {
|
||||
return multiValued;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is there a value for this doc?
|
||||
*/
|
||||
boolean hasValue(int docId);
|
||||
public abstract boolean hasValue(int docId);
|
||||
|
||||
long getValue(int docId);
|
||||
public abstract long getValue(int docId);
|
||||
|
||||
long getValueMissing(int docId, long missingValue);
|
||||
|
||||
Iter getIter(int docId);
|
||||
|
||||
void forEachValueInDoc(int docId, ValueInDocProc proc);
|
||||
|
||||
static interface ValueInDocProc {
|
||||
|
||||
void onValue(int docId, long value);
|
||||
|
||||
void onMissing(int docId);
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
if (hasValue(docId)) {
|
||||
return getValue(docId);
|
||||
}
|
||||
return missingValue;
|
||||
}
|
||||
|
||||
public Iter getIter(int docId) {
|
||||
assert !isMultiValued();
|
||||
if (hasValue(docId)) {
|
||||
return iter.reset(getValue(docId));
|
||||
} else {
|
||||
return Iter.Empty.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
static interface Iter {
|
||||
|
||||
public static abstract class DenseLongValues extends LongValues {
|
||||
|
||||
|
||||
protected DenseLongValues(boolean multiValued) {
|
||||
super(multiValued);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasValue(int docId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final long getValueMissing(int docId, long missingValue) {
|
||||
assert hasValue(docId);
|
||||
assert !isMultiValued();
|
||||
return getValue(docId);
|
||||
}
|
||||
|
||||
public final Iter getIter(int docId) {
|
||||
assert hasValue(docId);
|
||||
assert !isMultiValued();
|
||||
return iter.reset(getValue(docId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static abstract class OrdBasedLongValues extends LongValues {
|
||||
|
||||
protected final Docs ordinals;
|
||||
private final Iter.Multi iter;
|
||||
|
||||
protected OrdBasedLongValues(Ordinals.Docs ordinals) {
|
||||
super(ordinals.isMultiValued());
|
||||
this.ordinals = ordinals;
|
||||
iter = new Iter.Multi(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean hasValue(int docId) {
|
||||
return ordinals.getOrd(docId) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final long getValue(int docId) {
|
||||
return getByOrd(ordinals.getOrd(docId));
|
||||
}
|
||||
|
||||
protected abstract long getByOrd(int ord);
|
||||
|
||||
@Override
|
||||
public final Iter getIter(int docId) {
|
||||
return iter.reset(ordinals.getIter(docId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static interface Iter {
|
||||
|
||||
boolean hasNext();
|
||||
|
||||
long next();
|
||||
|
||||
static class Empty implements Iter {
|
||||
public static class Empty implements Iter {
|
||||
|
||||
public static final Empty INSTANCE = new Empty();
|
||||
|
||||
|
@ -74,7 +144,7 @@ public interface LongValues {
|
|||
}
|
||||
}
|
||||
|
||||
static class Single implements Iter {
|
||||
static class Single implements Iter {
|
||||
|
||||
public long value;
|
||||
public boolean done;
|
||||
|
@ -97,12 +167,41 @@ public interface LongValues {
|
|||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
static class Multi implements Iter {
|
||||
|
||||
private org.elasticsearch.index.fielddata.ordinals.Ordinals.Docs.Iter ordsIter;
|
||||
private int ord;
|
||||
private OrdBasedLongValues values;
|
||||
|
||||
public Multi(OrdBasedLongValues values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public Multi reset(Ordinals.Docs.Iter ordsIter) {
|
||||
this.ordsIter = ordsIter;
|
||||
this.ord = ordsIter.next();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ord != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long next() {
|
||||
long value = values.getByOrd(ord);
|
||||
ord = ordsIter.next();
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class Empty implements LongValues {
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
static class Empty extends LongValues {
|
||||
|
||||
public Empty() {
|
||||
super(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -115,34 +214,22 @@ public interface LongValues {
|
|||
throw new ElasticSearchIllegalStateException("Can't retrieve a value from an empty LongValues");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
return missingValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return Iter.Empty.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
|
||||
public static class FilteredLongValues implements LongValues {
|
||||
public static class FilteredLongValues extends LongValues {
|
||||
|
||||
protected final LongValues delegate;
|
||||
|
||||
public FilteredLongValues(LongValues delegate) {
|
||||
super(delegate.isMultiValued());
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
public boolean isMultiValued() {
|
||||
return delegate.isMultiValued();
|
||||
}
|
||||
|
||||
public boolean hasValue(int docId) {
|
||||
return delegate.hasValue(docId);
|
||||
}
|
||||
|
@ -151,17 +238,9 @@ public interface LongValues {
|
|||
return delegate.getValue(docId);
|
||||
}
|
||||
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
return delegate.getValueMissing(docId, missingValue);
|
||||
}
|
||||
|
||||
public Iter getIter(int docId) {
|
||||
return delegate.getIter(docId);
|
||||
}
|
||||
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
delegate.forEachValueInDoc(docId, proc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -222,7 +222,6 @@ public interface StringValues {
|
|||
|
||||
private final StringArrayRef arrayScratch = new StringArrayRef(new String[1], 1);
|
||||
private final ValuesIter valuesIter = new ValuesIter();
|
||||
private final Proc proc = new Proc();
|
||||
|
||||
public LongBased(LongValues values) {
|
||||
this.values = values;
|
||||
|
@ -254,7 +253,14 @@ public interface StringValues {
|
|||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
values.forEachValueInDoc(docId, this.proc.reset(proc));
|
||||
if (values.hasValue(docId)) {
|
||||
final LongValues.Iter longIter = values.getIter(docId);
|
||||
while(longIter.hasNext()) {
|
||||
proc.onValue(docId, Long.toString(longIter.next()));
|
||||
}
|
||||
} else {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
|
||||
static class ValuesIter implements Iter {
|
||||
|
@ -277,25 +283,7 @@ public interface StringValues {
|
|||
}
|
||||
}
|
||||
|
||||
static class Proc implements LongValues.ValueInDocProc {
|
||||
|
||||
private ValueInDocProc proc;
|
||||
|
||||
private Proc reset(ValueInDocProc proc) {
|
||||
this.proc = proc;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValue(int docId, long value) {
|
||||
proc.onValue(docId, Long.toString(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMissing(int docId) {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface WithOrdinals extends StringValues {
|
||||
|
|
|
@ -140,90 +140,20 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values, ordinals.ordinals());
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
|
||||
|
||||
private final byte[] values;
|
||||
private final Ordinals.Docs ordinals;
|
||||
|
||||
private final ValuesIter iter;
|
||||
|
||||
LongValues(byte[] values, Ordinals.Docs ordinals) {
|
||||
super(ordinals);
|
||||
this.values = values;
|
||||
this.ordinals = ordinals;
|
||||
this.iter = new ValuesIter(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return ordinals.isMultiValued();
|
||||
protected long getByOrd(int ord) {
|
||||
return (long) values[ord];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return ordinals.getOrd(docId) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[ordinals.getOrd(docId)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
int ord = ordinals.getOrd(docId);
|
||||
if (ord == 0) {
|
||||
return missingValue;
|
||||
} else {
|
||||
return (long) values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset(ordinals.getIter(docId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
Ordinals.Docs.Iter iter = ordinals.getIter(docId);
|
||||
int ord = iter.next();
|
||||
if (ord == 0) {
|
||||
proc.onMissing(docId);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
proc.onValue(docId, (long) values[ord]);
|
||||
} while ((ord = iter.next()) != 0);
|
||||
}
|
||||
|
||||
static class ValuesIter implements Iter {
|
||||
|
||||
private final byte[] values;
|
||||
private Ordinals.Docs.Iter ordsIter;
|
||||
private int ord;
|
||||
|
||||
ValuesIter(byte[] values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public ValuesIter reset(Ordinals.Docs.Iter ordsIter) {
|
||||
this.ordsIter = ordsIter;
|
||||
this.ord = ordsIter.next();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ord != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long next() {
|
||||
byte value = values[ord];
|
||||
ord = ordsIter.next();
|
||||
return (long) value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -370,23 +300,17 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values, set);
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues {
|
||||
|
||||
private final byte[] values;
|
||||
private final FixedBitSet set;
|
||||
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(byte[] values, FixedBitSet set) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return set.get(docId);
|
||||
|
@ -397,32 +321,6 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
if (set.get(docId)) {
|
||||
return (long) values[docId];
|
||||
} else {
|
||||
return missingValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
if (set.get(docId)) {
|
||||
return iter.reset((long) values[docId]);
|
||||
} else {
|
||||
return Iter.Empty.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
if (set.get(docId)) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
} else {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -538,44 +436,21 @@ public abstract class ByteArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
}
|
||||
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
|
||||
|
||||
private final byte[] values;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(byte[] values) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset((long) values[docId]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
|
|
@ -232,88 +232,18 @@ public abstract class DoubleArrayAtomicFieldData extends AtomicNumericFieldData
|
|||
}
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
|
||||
|
||||
private final double[] values;
|
||||
private final Ordinals.Docs ordinals;
|
||||
private final ValuesIter iter;
|
||||
|
||||
LongValues(double[] values, Ordinals.Docs ordinals) {
|
||||
super(ordinals);
|
||||
this.values = values;
|
||||
this.ordinals = ordinals;
|
||||
this.iter = new ValuesIter(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return ordinals.isMultiValued();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return ordinals.getOrd(docId) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[ordinals.getOrd(docId)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
int ord = ordinals.getOrd(docId);
|
||||
if (ord == 0) {
|
||||
return missingValue;
|
||||
} else {
|
||||
return (long) values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset(ordinals.getIter(docId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
Ordinals.Docs.Iter iter = ordinals.getIter(docId);
|
||||
int ord = iter.next();
|
||||
if (ord == 0) {
|
||||
proc.onMissing(docId);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
proc.onValue(docId, (long) values[ord]);
|
||||
} while ((ord = iter.next()) != 0);
|
||||
}
|
||||
|
||||
static class ValuesIter implements LongValues.Iter {
|
||||
|
||||
private final double[] values;
|
||||
private Ordinals.Docs.Iter ordsIter;
|
||||
private int ord;
|
||||
|
||||
ValuesIter(double[] values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public ValuesIter reset(Ordinals.Docs.Iter ordsIter) {
|
||||
this.ordsIter = ordsIter;
|
||||
this.ord = ordsIter.next();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ord != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long next() {
|
||||
double value = values[ord];
|
||||
ord = ordsIter.next();
|
||||
return (long) value;
|
||||
}
|
||||
protected final long getByOrd(int ord) {
|
||||
return (long)values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -459,23 +389,17 @@ public abstract class DoubleArrayAtomicFieldData extends AtomicNumericFieldData
|
|||
return new DoubleValues(values, set);
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues {
|
||||
|
||||
private final double[] values;
|
||||
private final FixedBitSet set;
|
||||
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(double[] values, FixedBitSet set) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return set.get(docId);
|
||||
|
@ -485,31 +409,6 @@ public abstract class DoubleArrayAtomicFieldData extends AtomicNumericFieldData
|
|||
public long getValue(int docId) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
if (set.get(docId)) {
|
||||
return (long) values[docId];
|
||||
} else {
|
||||
return missingValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
if (set.get(docId)) {
|
||||
return iter.reset((long) values[docId]);
|
||||
} else {
|
||||
return Iter.Empty.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
if (set.get(docId)) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -656,45 +555,20 @@ public abstract class DoubleArrayAtomicFieldData extends AtomicNumericFieldData
|
|||
}
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
|
||||
|
||||
private final double[] values;
|
||||
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(double[] values) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset((long) values[docId]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
|
|
@ -146,88 +146,18 @@ public abstract class FloatArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values, ordinals.ordinals());
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
|
||||
|
||||
private final float[] values;
|
||||
private final Ordinals.Docs ordinals;
|
||||
private final ValuesIter iter;
|
||||
|
||||
LongValues(float[] values, Ordinals.Docs ordinals) {
|
||||
super(ordinals);
|
||||
this.values = values;
|
||||
this.ordinals = ordinals;
|
||||
this.iter = new ValuesIter(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return ordinals.isMultiValued();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return ordinals.getOrd(docId) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[ordinals.getOrd(docId)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
int ord = ordinals.getOrd(docId);
|
||||
if (ord == 0) {
|
||||
return missingValue;
|
||||
} else {
|
||||
return (long) values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset(ordinals.getIter(docId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
Ordinals.Docs.Iter iter = ordinals.getIter(docId);
|
||||
int ord = iter.next();
|
||||
if (ord == 0) {
|
||||
proc.onMissing(docId);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
proc.onValue(docId, (long) values[ord]);
|
||||
} while ((ord = iter.next()) != 0);
|
||||
}
|
||||
|
||||
static class ValuesIter implements Iter {
|
||||
|
||||
private final float[] values;
|
||||
private Ordinals.Docs.Iter ordsIter;
|
||||
private int ord;
|
||||
|
||||
ValuesIter(float[] values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public ValuesIter reset(Ordinals.Docs.Iter ordsIter) {
|
||||
this.ordsIter = ordsIter;
|
||||
this.ord = ordsIter.next();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ord != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long next() {
|
||||
float value = values[ord];
|
||||
ord = ordsIter.next();
|
||||
return (long) value;
|
||||
}
|
||||
public long getByOrd(int ord) {
|
||||
return (long) values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -374,22 +304,17 @@ public abstract class FloatArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
}
|
||||
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues {
|
||||
|
||||
private final float[] values;
|
||||
private final FixedBitSet set;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(float[] values, FixedBitSet set) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return set.get(docId);
|
||||
|
@ -399,33 +324,6 @@ public abstract class FloatArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
public long getValue(int docId) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
if (set.get(docId)) {
|
||||
return (long) values[docId];
|
||||
} else {
|
||||
return missingValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
if (set.get(docId)) {
|
||||
return iter.reset((long) values[docId]);
|
||||
} else {
|
||||
return Iter.Empty.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
if (set.get(docId)) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
} else {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -541,44 +439,20 @@ public abstract class FloatArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
}
|
||||
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
|
||||
|
||||
private final float[] values;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(float[] values) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset((long) values[docId]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
|
|
@ -148,89 +148,20 @@ public abstract class IntArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values, ordinals.ordinals());
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
|
||||
|
||||
private final int[] values;
|
||||
private final Ordinals.Docs ordinals;
|
||||
private final ValuesIter iter;
|
||||
|
||||
LongValues(int[] values, Ordinals.Docs ordinals) {
|
||||
super(ordinals);
|
||||
this.values = values;
|
||||
this.ordinals = ordinals;
|
||||
this.iter = new ValuesIter(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return ordinals.isMultiValued();
|
||||
public long getByOrd(int ord) {
|
||||
return (long) values[ord];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return ordinals.getOrd(docId) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[ordinals.getOrd(docId)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
int ord = ordinals.getOrd(docId);
|
||||
if (ord == 0) {
|
||||
return missingValue;
|
||||
} else {
|
||||
return (long) values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset(ordinals.getIter(docId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
Ordinals.Docs.Iter iter = ordinals.getIter(docId);
|
||||
int ord = iter.next();
|
||||
if (ord == 0) {
|
||||
proc.onMissing(docId);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
proc.onValue(docId, (long) values[ord]);
|
||||
} while ((ord = iter.next()) != 0);
|
||||
}
|
||||
|
||||
static class ValuesIter implements Iter {
|
||||
|
||||
private final int[] values;
|
||||
private Ordinals.Docs.Iter ordsIter;
|
||||
private int ord;
|
||||
|
||||
ValuesIter(int[] values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public ValuesIter reset(Ordinals.Docs.Iter ordsIter) {
|
||||
this.ordsIter = ordsIter;
|
||||
this.ord = ordsIter.next();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ord != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long next() {
|
||||
int value = values[ord];
|
||||
ord = ordsIter.next();
|
||||
return (long) value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -375,22 +306,17 @@ public abstract class IntArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values, set);
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues {
|
||||
|
||||
private final int[] values;
|
||||
private final FixedBitSet set;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(int[] values, FixedBitSet set) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return set.get(docId);
|
||||
|
@ -401,32 +327,6 @@ public abstract class IntArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
if (set.get(docId)) {
|
||||
return (long) values[docId];
|
||||
} else {
|
||||
return missingValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
if (set.get(docId)) {
|
||||
return iter.reset((long) values[docId]);
|
||||
} else {
|
||||
return Iter.Empty.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
if (set.get(docId)) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
} else {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -540,45 +440,21 @@ public abstract class IntArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values);
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
|
||||
|
||||
private final int[] values;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(int[] values) {
|
||||
super(false);
|
||||
assert values.length != 0;
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset((long) values[docId]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
|
|
@ -226,88 +226,18 @@ public abstract class LongArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
}
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
|
||||
|
||||
private final long[] values;
|
||||
private final Ordinals.Docs ordinals;
|
||||
private final ValuesIter iter;
|
||||
|
||||
LongValues(long[] values, Ordinals.Docs ordinals) {
|
||||
super(ordinals);
|
||||
this.values = values;
|
||||
this.ordinals = ordinals;
|
||||
this.iter = new ValuesIter(values);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return ordinals.isMultiValued();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return ordinals.getOrd(docId) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return values[ordinals.getOrd(docId)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
int ord = ordinals.getOrd(docId);
|
||||
if (ord == 0) {
|
||||
return missingValue;
|
||||
} else {
|
||||
return values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset(ordinals.getIter(docId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
Ordinals.Docs.Iter iter = ordinals.getIter(docId);
|
||||
int ord = iter.next();
|
||||
if (ord == 0) {
|
||||
proc.onMissing(docId);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
proc.onValue(docId, values[ord]);
|
||||
} while ((ord = iter.next()) != 0);
|
||||
}
|
||||
|
||||
static class ValuesIter implements Iter {
|
||||
|
||||
private final long[] values;
|
||||
private Ordinals.Docs.Iter ordsIter;
|
||||
private int ord;
|
||||
|
||||
ValuesIter(long[] values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public ValuesIter reset(Ordinals.Docs.Iter ordsIter) {
|
||||
this.ordsIter = ordsIter;
|
||||
this.ord = ordsIter.next();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ord != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long next() {
|
||||
long value = values[ord];
|
||||
ord = ordsIter.next();
|
||||
return value;
|
||||
}
|
||||
public long getByOrd(int ord) {
|
||||
return values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -502,22 +432,17 @@ public abstract class LongArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
}
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues {
|
||||
|
||||
private final long[] values;
|
||||
private final FixedBitSet set;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(long[] values, FixedBitSet set) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return set.get(docId);
|
||||
|
@ -527,33 +452,6 @@ public abstract class LongArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
public long getValue(int docId) {
|
||||
return values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
if (set.get(docId)) {
|
||||
return values[docId];
|
||||
} else {
|
||||
return missingValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
if (set.get(docId)) {
|
||||
return iter.reset(values[docId]);
|
||||
} else {
|
||||
return Iter.Empty.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
if (set.get(docId)) {
|
||||
proc.onValue(docId, values[docId]);
|
||||
} else {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -702,44 +600,21 @@ public abstract class LongArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
}
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
|
||||
|
||||
private final long[] values;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(long[] values) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
return values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset(values[docId]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
proc.onValue(docId, values[docId]);
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
|
|
@ -21,11 +21,13 @@ package org.elasticsearch.index.fielddata.plain;
|
|||
|
||||
import org.apache.lucene.util.FixedBitSet;
|
||||
import org.elasticsearch.common.RamUsage;
|
||||
import org.elasticsearch.index.fielddata.*;
|
||||
import org.elasticsearch.index.fielddata.AtomicNumericFieldData;
|
||||
import org.elasticsearch.index.fielddata.BytesValues;
|
||||
import org.elasticsearch.index.fielddata.DoubleValues;
|
||||
import org.elasticsearch.index.fielddata.LongValues;
|
||||
import org.elasticsearch.index.fielddata.ScriptDocValues;
|
||||
import org.elasticsearch.index.fielddata.StringValues;
|
||||
import org.elasticsearch.index.fielddata.ordinals.Ordinals;
|
||||
import org.elasticsearch.index.fielddata.util.DoubleArrayRef;
|
||||
import org.elasticsearch.index.fielddata.util.IntArrayRef;
|
||||
import org.elasticsearch.index.fielddata.util.LongArrayRef;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -146,89 +148,20 @@ public abstract class ShortArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values, ordinals.ordinals());
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.OrdBasedLongValues {
|
||||
|
||||
private final short[] values;
|
||||
private final Ordinals.Docs ordinals;
|
||||
private final ValuesIter iter;
|
||||
|
||||
LongValues(short[] values, Ordinals.Docs ordinals) {
|
||||
super(ordinals);
|
||||
this.values = values;
|
||||
this.ordinals = ordinals;
|
||||
this.iter = new ValuesIter(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return ordinals.isMultiValued();
|
||||
public long getByOrd(int ord) {
|
||||
return (long) values[ord];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return ordinals.getOrd(docId) != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[ordinals.getOrd(docId)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
int ord = ordinals.getOrd(docId);
|
||||
if (ord == 0) {
|
||||
return missingValue;
|
||||
} else {
|
||||
return (long) values[ord];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset(ordinals.getIter(docId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
Ordinals.Docs.Iter iter = ordinals.getIter(docId);
|
||||
int ord = iter.next();
|
||||
if (ord == 0) {
|
||||
proc.onMissing(docId);
|
||||
return;
|
||||
}
|
||||
do {
|
||||
proc.onValue(docId, (long) values[ord]);
|
||||
} while ((ord = iter.next()) != 0);
|
||||
}
|
||||
|
||||
static class ValuesIter implements Iter {
|
||||
|
||||
private final short[] values;
|
||||
private Ordinals.Docs.Iter ordsIter;
|
||||
private int ord;
|
||||
|
||||
ValuesIter(short[] values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public ValuesIter reset(Ordinals.Docs.Iter ordsIter) {
|
||||
this.ordsIter = ordsIter;
|
||||
this.ord = ordsIter.next();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return ord != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long next() {
|
||||
short value = values[ord];
|
||||
ord = ordsIter.next();
|
||||
return (long) value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -373,22 +306,17 @@ public abstract class ShortArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values, set);
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues {
|
||||
|
||||
private final short[] values;
|
||||
private final FixedBitSet set;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(short[] values, FixedBitSet set) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return set.get(docId);
|
||||
|
@ -398,33 +326,6 @@ public abstract class ShortArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
public long getValue(int docId) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
if (set.get(docId)) {
|
||||
return (long) values[docId];
|
||||
} else {
|
||||
return missingValue;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
if (set.get(docId)) {
|
||||
return iter.reset((long) values[docId]);
|
||||
} else {
|
||||
return Iter.Empty.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
if (set.get(docId)) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
} else {
|
||||
proc.onMissing(docId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
@ -541,44 +442,20 @@ public abstract class ShortArrayAtomicFieldData extends AtomicNumericFieldData {
|
|||
return new DoubleValues(values);
|
||||
}
|
||||
|
||||
static class LongValues implements org.elasticsearch.index.fielddata.LongValues {
|
||||
static class LongValues extends org.elasticsearch.index.fielddata.LongValues.DenseLongValues {
|
||||
|
||||
private final short[] values;
|
||||
private final Iter.Single iter = new Iter.Single();
|
||||
|
||||
LongValues(short[] values) {
|
||||
super(false);
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMultiValued() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValue(int docId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValue(int docId) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getValueMissing(int docId, long missingValue) {
|
||||
return (long) values[docId];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iter getIter(int docId) {
|
||||
return iter.reset((long) values[docId]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forEachValueInDoc(int docId, ValueInDocProc proc) {
|
||||
proc.onValue(docId, (long) values[docId]);
|
||||
}
|
||||
}
|
||||
|
||||
static class DoubleValues implements org.elasticsearch.index.fielddata.DoubleValues {
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Licensed to ElasticSearch and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. ElasticSearch licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.search.facet;
|
||||
|
||||
import org.elasticsearch.index.fielddata.LongValues;
|
||||
import org.elasticsearch.index.fielddata.LongValues.Iter;
|
||||
|
||||
/**
|
||||
* Simple Facet aggregator base class for {@link LongValues}
|
||||
*/
|
||||
public abstract class LongFacetAggregatorBase {
|
||||
private int total;
|
||||
private int missing;
|
||||
|
||||
public void onDoc(int docId, LongValues values) {
|
||||
if (values.hasValue(docId)) {
|
||||
final Iter iter = values.getIter(docId);
|
||||
while(iter.hasNext()) {
|
||||
onValue(docId, iter.next());
|
||||
total++;
|
||||
}
|
||||
} else {
|
||||
missing++;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void onValue(int docId, long next);
|
||||
|
||||
public final int total() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public final int missing() {
|
||||
return missing;
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@ import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
|||
import org.elasticsearch.index.fielddata.LongValues;
|
||||
import org.elasticsearch.search.facet.FacetExecutor;
|
||||
import org.elasticsearch.search.facet.InternalFacet;
|
||||
import org.elasticsearch.search.facet.LongFacetAggregatorBase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -76,7 +77,7 @@ public class CountDateHistogramFacetExecutor extends FacetExecutor {
|
|||
|
||||
@Override
|
||||
public void collect(int doc) throws IOException {
|
||||
values.forEachValueInDoc(doc, histoProc);
|
||||
histoProc.onDoc(doc, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,7 +85,7 @@ public class CountDateHistogramFacetExecutor extends FacetExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DateHistogramProc implements LongValues.ValueInDocProc {
|
||||
public static class DateHistogramProc extends LongFacetAggregatorBase {
|
||||
|
||||
private final TLongLongHashMap counts;
|
||||
private final TimeZoneRounding tzRounding;
|
||||
|
@ -94,10 +95,6 @@ public class CountDateHistogramFacetExecutor extends FacetExecutor {
|
|||
this.tzRounding = tzRounding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMissing(int docId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValue(int docId, long value) {
|
||||
counts.adjustOrPutValue(tzRounding.calc(value), 1, 1);
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.elasticsearch.index.fielddata.IndexNumericFieldData;
|
|||
import org.elasticsearch.index.fielddata.LongValues;
|
||||
import org.elasticsearch.search.facet.FacetExecutor;
|
||||
import org.elasticsearch.search.facet.InternalFacet;
|
||||
import org.elasticsearch.search.facet.LongFacetAggregatorBase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -79,7 +80,7 @@ public class ValueDateHistogramFacetExecutor extends FacetExecutor {
|
|||
|
||||
@Override
|
||||
public void collect(int doc) throws IOException {
|
||||
keyValues.forEachValueInDoc(doc, histoProc);
|
||||
histoProc.onDoc(doc, keyValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -87,7 +88,7 @@ public class ValueDateHistogramFacetExecutor extends FacetExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DateHistogramProc implements LongValues.ValueInDocProc {
|
||||
public static class DateHistogramProc extends LongFacetAggregatorBase {
|
||||
|
||||
final ExtTLongObjectHashMap<InternalFullDateHistogramFacet.FullEntry> entries;
|
||||
private final TimeZoneRounding tzRounding;
|
||||
|
@ -101,10 +102,6 @@ public class ValueDateHistogramFacetExecutor extends FacetExecutor {
|
|||
this.entries = entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMissing(int docId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValue(int docId, long value) {
|
||||
long time = tzRounding.calc(value);
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.index.fielddata.LongValues;
|
|||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.facet.FacetExecutor;
|
||||
import org.elasticsearch.search.facet.InternalFacet;
|
||||
import org.elasticsearch.search.facet.LongFacetAggregatorBase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -86,7 +87,7 @@ public class ValueScriptDateHistogramFacetExecutor extends FacetExecutor {
|
|||
|
||||
@Override
|
||||
public void collect(int doc) throws IOException {
|
||||
keyValues.forEachValueInDoc(doc, histoProc);
|
||||
histoProc.onDoc(doc, keyValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,7 +95,7 @@ public class ValueScriptDateHistogramFacetExecutor extends FacetExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DateHistogramProc implements LongValues.ValueInDocProc {
|
||||
public static class DateHistogramProc extends LongFacetAggregatorBase {
|
||||
|
||||
private final TimeZoneRounding tzRounding;
|
||||
protected final SearchScript valueScript;
|
||||
|
@ -107,10 +108,6 @@ public class ValueScriptDateHistogramFacetExecutor extends FacetExecutor {
|
|||
this.entries = entries;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMissing(int docId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValue(int docId, long value) {
|
||||
valueScript.setNextDocId(docId);
|
||||
|
|
|
@ -34,6 +34,7 @@ import org.elasticsearch.index.fielddata.LongValues;
|
|||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.facet.FacetExecutor;
|
||||
import org.elasticsearch.search.facet.InternalFacet;
|
||||
import org.elasticsearch.search.facet.LongFacetAggregatorBase;
|
||||
import org.elasticsearch.search.facet.terms.TermsFacet;
|
||||
import org.elasticsearch.search.facet.terms.support.EntryPriorityQueue;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
@ -50,7 +51,6 @@ public class TermsLongFacetExecutor extends FacetExecutor {
|
|||
private final IndexNumericFieldData indexFieldData;
|
||||
private final TermsFacet.ComparatorType comparatorType;
|
||||
private final int size;
|
||||
private final int numberOfShards;
|
||||
private final SearchScript script;
|
||||
private final ImmutableSet<BytesRef> excluded;
|
||||
|
||||
|
@ -63,7 +63,6 @@ public class TermsLongFacetExecutor extends FacetExecutor {
|
|||
this.indexFieldData = indexFieldData;
|
||||
this.size = size;
|
||||
this.comparatorType = comparatorType;
|
||||
this.numberOfShards = context.numberOfShards();
|
||||
this.script = script;
|
||||
this.excluded = excluded;
|
||||
|
||||
|
@ -147,7 +146,7 @@ public class TermsLongFacetExecutor extends FacetExecutor {
|
|||
|
||||
@Override
|
||||
public void collect(int doc) throws IOException {
|
||||
values.forEachValueInDoc(doc, aggregator);
|
||||
aggregator.onDoc(doc, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -200,13 +199,10 @@ public class TermsLongFacetExecutor extends FacetExecutor {
|
|||
}
|
||||
}
|
||||
|
||||
public static class StaticAggregatorValueProc implements LongValues.ValueInDocProc {
|
||||
public static class StaticAggregatorValueProc extends LongFacetAggregatorBase {
|
||||
|
||||
private final TLongIntHashMap facets;
|
||||
|
||||
private int missing;
|
||||
private int total;
|
||||
|
||||
public StaticAggregatorValueProc(TLongIntHashMap facets) {
|
||||
this.facets = facets;
|
||||
}
|
||||
|
@ -214,24 +210,10 @@ public class TermsLongFacetExecutor extends FacetExecutor {
|
|||
@Override
|
||||
public void onValue(int docId, long value) {
|
||||
facets.adjustOrPutValue(value, 1, 1);
|
||||
total++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMissing(int docId) {
|
||||
missing++;
|
||||
}
|
||||
|
||||
public final TLongIntHashMap facets() {
|
||||
return facets;
|
||||
}
|
||||
|
||||
public final int missing() {
|
||||
return this.missing;
|
||||
}
|
||||
|
||||
public final int total() {
|
||||
return this.total;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.elasticsearch.index.fielddata.LongValues;
|
|||
import org.elasticsearch.script.SearchScript;
|
||||
import org.elasticsearch.search.facet.FacetExecutor;
|
||||
import org.elasticsearch.search.facet.InternalFacet;
|
||||
import org.elasticsearch.search.facet.LongFacetAggregatorBase;
|
||||
import org.elasticsearch.search.facet.termsstats.TermsStatsFacet;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
|
@ -128,19 +129,18 @@ public class TermsStatsLongFacetExecutor extends FacetExecutor {
|
|||
|
||||
@Override
|
||||
public void collect(int doc) throws IOException {
|
||||
keyValues.forEachValueInDoc(doc, aggregator);
|
||||
aggregator.onDoc(doc, keyValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postCollection() {
|
||||
TermsStatsLongFacetExecutor.this.missing = aggregator.missing;
|
||||
TermsStatsLongFacetExecutor.this.missing = aggregator.missing();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Aggregator implements LongValues.ValueInDocProc {
|
||||
public static class Aggregator extends LongFacetAggregatorBase {
|
||||
|
||||
final ExtTLongObjectHashMap<InternalTermsStatsLongFacet.LongEntry> entries;
|
||||
int missing;
|
||||
DoubleValues valueValues;
|
||||
final ValueAggregator valueAggregator = new ValueAggregator();
|
||||
|
||||
|
@ -160,10 +160,6 @@ public class TermsStatsLongFacetExecutor extends FacetExecutor {
|
|||
valueValues.forEachValueInDoc(docId, valueAggregator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMissing(int docId) {
|
||||
missing++;
|
||||
}
|
||||
|
||||
public static class ValueAggregator implements DoubleValues.ValueInDocProc {
|
||||
|
||||
|
|
|
@ -19,25 +19,32 @@
|
|||
|
||||
package org.elasticsearch.test.unit.index.fielddata;
|
||||
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.index.*;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.elasticsearch.common.lucene.HashedBytesRef;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.fielddata.*;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.sameInstance;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.sameInstance;
|
||||
import org.apache.lucene.analysis.standard.StandardAnalyzer;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.AtomicReaderContext;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.apache.lucene.index.IndexWriter;
|
||||
import org.apache.lucene.index.IndexWriterConfig;
|
||||
import org.apache.lucene.index.SlowCompositeReaderWrapper;
|
||||
import org.apache.lucene.store.RAMDirectory;
|
||||
import org.elasticsearch.common.lucene.Lucene;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.fielddata.DoubleValues;
|
||||
import org.elasticsearch.index.fielddata.FieldDataType;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldData;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||
import org.elasticsearch.index.fielddata.StringValues;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.testng.annotations.AfterMethod;
|
||||
import org.testng.annotations.BeforeMethod;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -115,42 +122,6 @@ public abstract class AbstractFieldDataTests {
|
|||
}
|
||||
}
|
||||
|
||||
public static class LongValuesVerifierProc implements LongValues.ValueInDocProc {
|
||||
|
||||
private static final Long MISSING = new Long(0);
|
||||
|
||||
private final int docId;
|
||||
private final List<Long> expected = new ArrayList<Long>();
|
||||
|
||||
private int idx;
|
||||
|
||||
LongValuesVerifierProc(int docId) {
|
||||
this.docId = docId;
|
||||
}
|
||||
|
||||
public LongValuesVerifierProc addExpected(long value) {
|
||||
expected.add(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public LongValuesVerifierProc addMissing() {
|
||||
expected.add(MISSING);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onValue(int docId, long value) {
|
||||
assertThat(docId, equalTo(this.docId));
|
||||
assertThat(value, equalTo(expected.get(idx++)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMissing(int docId) {
|
||||
assertThat(docId, equalTo(this.docId));
|
||||
assertThat(MISSING, sameInstance(expected.get(idx++)));
|
||||
}
|
||||
}
|
||||
|
||||
public static class DoubleValuesVerifierProc implements DoubleValues.ValueInDocProc {
|
||||
|
||||
private static final Double MISSING = new Double(0);
|
||||
|
|
|
@ -79,10 +79,6 @@ public abstract class NumericFieldDataTests extends StringFieldDataTests {
|
|||
assertThat(longValuesIter.next(), equalTo(3l));
|
||||
assertThat(longValuesIter.hasNext(), equalTo(false));
|
||||
|
||||
longValues.forEachValueInDoc(0, new LongValuesVerifierProc(0).addExpected(2l));
|
||||
longValues.forEachValueInDoc(1, new LongValuesVerifierProc(1).addExpected(1l));
|
||||
longValues.forEachValueInDoc(2, new LongValuesVerifierProc(2).addExpected(3l));
|
||||
|
||||
DoubleValues doubleValues = fieldData.getDoubleValues();
|
||||
|
||||
assertThat(doubleValues.isMultiValued(), equalTo(false));
|
||||
|
@ -172,10 +168,6 @@ public abstract class NumericFieldDataTests extends StringFieldDataTests {
|
|||
assertThat(longValuesIter.next(), equalTo(3l));
|
||||
assertThat(longValuesIter.hasNext(), equalTo(false));
|
||||
|
||||
longValues.forEachValueInDoc(0, new LongValuesVerifierProc(0).addExpected(2l));
|
||||
longValues.forEachValueInDoc(1, new LongValuesVerifierProc(1).addMissing());
|
||||
longValues.forEachValueInDoc(2, new LongValuesVerifierProc(2).addExpected(3l));
|
||||
|
||||
DoubleValues doubleValues = fieldData.getDoubleValues();
|
||||
|
||||
assertThat(doubleValues.isMultiValued(), equalTo(false));
|
||||
|
@ -295,10 +287,6 @@ public abstract class NumericFieldDataTests extends StringFieldDataTests {
|
|||
assertThat(longValuesIter.next(), equalTo(3l));
|
||||
assertThat(longValuesIter.hasNext(), equalTo(false));
|
||||
|
||||
longValues.forEachValueInDoc(0, new LongValuesVerifierProc(0).addExpected(2l).addExpected(4l));
|
||||
longValues.forEachValueInDoc(1, new LongValuesVerifierProc(1).addExpected(1l));
|
||||
longValues.forEachValueInDoc(2, new LongValuesVerifierProc(2).addExpected(3l));
|
||||
|
||||
DoubleValues doubleValues = fieldData.getDoubleValues();
|
||||
|
||||
assertThat(doubleValues.isMultiValued(), equalTo(true));
|
||||
|
@ -375,10 +363,6 @@ public abstract class NumericFieldDataTests extends StringFieldDataTests {
|
|||
assertThat(longValuesIter.next(), equalTo(3l));
|
||||
assertThat(longValuesIter.hasNext(), equalTo(false));
|
||||
|
||||
longValues.forEachValueInDoc(0, new LongValuesVerifierProc(0).addExpected(2l).addExpected(4l));
|
||||
longValues.forEachValueInDoc(1, new LongValuesVerifierProc(1).addMissing());
|
||||
longValues.forEachValueInDoc(2, new LongValuesVerifierProc(2).addExpected(3l));
|
||||
|
||||
DoubleValues doubleValues = fieldData.getDoubleValues();
|
||||
|
||||
assertThat(doubleValues.isMultiValued(), equalTo(true));
|
||||
|
@ -445,10 +429,6 @@ public abstract class NumericFieldDataTests extends StringFieldDataTests {
|
|||
longValuesIter = longValues.getIter(2);
|
||||
assertThat(longValuesIter.hasNext(), equalTo(false));
|
||||
|
||||
longValues.forEachValueInDoc(0, new LongValuesVerifierProc(0).addMissing());
|
||||
longValues.forEachValueInDoc(1, new LongValuesVerifierProc(1).addMissing());
|
||||
longValues.forEachValueInDoc(2, new LongValuesVerifierProc(2).addMissing());
|
||||
|
||||
// double values
|
||||
|
||||
DoubleValues doubleValues = fieldData.getDoubleValues();
|
||||
|
|
Loading…
Reference in New Issue