Fix implementation of currentValueHash in FieldDataSource.Bytes.SortedAndUnique.
Close #4330
This commit is contained in:
parent
9e4b5ea242
commit
346d8efeb5
|
@ -79,6 +79,7 @@ public class StringTermsAggregator extends BucketsAggregator {
|
|||
continue;
|
||||
}
|
||||
final int hash = values.currentValueHash();
|
||||
assert hash == bytes.hashCode();
|
||||
int bucketOrdinal = bucketOrds.add(bytes, hash);
|
||||
if (bucketOrdinal < 0) { // already seen
|
||||
bucketOrdinal = - 1 - bucketOrdinal;
|
||||
|
|
|
@ -166,7 +166,7 @@ public abstract class FieldDataSource {
|
|||
bytes.clear();
|
||||
bytes.reinit();
|
||||
for (int i = 0; i < numValues; ++i) {
|
||||
bytes.add(super.nextValue(), super.hashCode());
|
||||
bytes.add(super.nextValue(), super.currentValueHash());
|
||||
}
|
||||
numUniqueValues = bytes.size();
|
||||
sortedIds = bytes.sort(BytesRef.getUTF8SortedAsUnicodeComparator());
|
||||
|
@ -180,6 +180,11 @@ public abstract class FieldDataSource {
|
|||
return spare;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int currentValueHash() {
|
||||
return spare.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrder() {
|
||||
return Order.BYTES;
|
||||
|
|
Loading…
Reference in New Issue