mirror of https://github.com/apache/lucene.git
LUCENE-6793: Make LegacyNumericRangeQuery and point queries less subject to hash collisions.
This commit is contained in:
parent
6c0846107a
commit
509c6a0acb
|
@ -115,6 +115,9 @@ Optimizations
|
|||
merging to merge sort the already sorted segments instead of
|
||||
re-indexing (Mike McCandless)
|
||||
|
||||
* LUCENE-6793: LegacyNumericRangeQuery.hashCode() is now less subject to hash
|
||||
collisions. (J.B. Langston via Adrien Grand)
|
||||
|
||||
Changes in Runtime Behavior
|
||||
|
||||
* LUCENE-6789: IndexSearcher's default Similarity is changed to BM25Similarity.
|
||||
|
|
|
@ -348,12 +348,12 @@ public final class LegacyNumericRangeQuery<T extends Number> extends MultiTermQu
|
|||
@Override
|
||||
public final int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash += precisionStep^0x64365465;
|
||||
if (min != null) hash += min.hashCode()^0x14fa55fb;
|
||||
if (max != null) hash += max.hashCode()^0x733fa5fe;
|
||||
return hash +
|
||||
(Boolean.valueOf(minInclusive).hashCode()^0x14fa55fb)+
|
||||
(Boolean.valueOf(maxInclusive).hashCode()^0x733fa5fe);
|
||||
hash = 31 * hash + precisionStep;
|
||||
hash = 31 * hash + Objects.hashCode(min);
|
||||
hash = 31 * hash + Objects.hashCode(max);
|
||||
hash = 31 * hash + Objects.hashCode(minInclusive);
|
||||
hash = 31 * hash + Objects.hashCode(maxInclusive);
|
||||
return hash;
|
||||
}
|
||||
|
||||
// members (package private, to be also fast accessible by NumericRangeTermEnum)
|
||||
|
|
|
@ -301,9 +301,9 @@ public class PointInSetQuery extends Query {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash += sortedPackedPointsHashCode^0x14fa55fb;
|
||||
hash += numDims^0x14fa55fb;
|
||||
hash += bytesPerDim^0x14fa55fb;
|
||||
hash = 31 * hash + sortedPackedPointsHashCode;
|
||||
hash = 31 * hash + numDims;
|
||||
hash = 31 * hash + bytesPerDim;
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
|
@ -287,12 +287,12 @@ public abstract class PointRangeQuery extends Query {
|
|||
@Override
|
||||
public int hashCode() {
|
||||
int hash = super.hashCode();
|
||||
hash += Arrays.hashCode(lowerPoint)^0x14fa55fb;
|
||||
hash += Arrays.hashCode(upperPoint)^0x733fa5fe;
|
||||
hash += Arrays.hashCode(lowerInclusive)^0x14fa55fb;
|
||||
hash += Arrays.hashCode(upperInclusive)^0x733fa5fe;
|
||||
hash += numDims^0x14fa55fb;
|
||||
hash += Objects.hashCode(bytesPerDim);
|
||||
hash = 31 * hash + Arrays.hashCode(lowerPoint);
|
||||
hash = 31 * hash + Arrays.hashCode(upperPoint);
|
||||
hash = 31 * hash + Arrays.hashCode(lowerInclusive);
|
||||
hash = 31 * hash + Arrays.hashCode(upperInclusive);
|
||||
hash = 31 * hash + numDims;
|
||||
hash = 31 * hash + Objects.hashCode(bytesPerDim);
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue