rehash the docvalues in DocValuesSliceQuery using BitMixer.mix instead of the naive Long.hashCode.
This commit is contained in:
parent
f611f1c99e
commit
43b419b230
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.search.slice;
|
package org.elasticsearch.search.slice;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.BitMixer;
|
||||||
import org.apache.lucene.index.LeafReaderContext;
|
import org.apache.lucene.index.LeafReaderContext;
|
||||||
import org.apache.lucene.index.DocValues;
|
import org.apache.lucene.index.DocValues;
|
||||||
import org.apache.lucene.index.SortedNumericDocValues;
|
import org.apache.lucene.index.SortedNumericDocValues;
|
||||||
|
@ -51,7 +52,7 @@ public final class DocValuesSliceQuery extends SliceQuery {
|
||||||
public boolean get(int doc) {
|
public boolean get(int doc) {
|
||||||
values.setDocument(doc);
|
values.setDocument(doc);
|
||||||
for (int i = 0; i < values.count(); i++) {
|
for (int i = 0; i < values.count(); i++) {
|
||||||
return contains(Long.hashCode(values.valueAt(i)));
|
return contains(BitMixer.mix(values.valueAt(i)));
|
||||||
}
|
}
|
||||||
return contains(0);
|
return contains(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.search.slice;
|
package org.elasticsearch.search.slice;
|
||||||
|
|
||||||
|
import com.carrotsearch.hppc.BitMixer;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
import org.apache.lucene.document.SortedNumericDocValuesField;
|
import org.apache.lucene.document.SortedNumericDocValuesField;
|
||||||
|
@ -77,8 +78,8 @@ public class DocValuesSliceQueryTests extends ESTestCase {
|
||||||
doc.add(new SortedNumericDocValuesField("intField", intValue));
|
doc.add(new SortedNumericDocValuesField("intField", intValue));
|
||||||
doc.add(new SortedNumericDocValuesField("doubleField", doubleValue));
|
doc.add(new SortedNumericDocValuesField("doubleField", doubleValue));
|
||||||
w.addDocument(doc);
|
w.addDocument(doc);
|
||||||
sliceCounters1[Math.floorMod(Long.hashCode(intValue), max)] ++;
|
sliceCounters1[Math.floorMod(BitMixer.mix((long) intValue), max)] ++;
|
||||||
sliceCounters2[Math.floorMod(Long.hashCode(doubleValue), max)] ++;
|
sliceCounters2[Math.floorMod(BitMixer.mix(doubleValue), max)] ++;
|
||||||
keys.add(uuid);
|
keys.add(uuid);
|
||||||
}
|
}
|
||||||
final IndexReader reader = w.getReader();
|
final IndexReader reader = w.getReader();
|
||||||
|
|
Loading…
Reference in New Issue