Skip to content

Commit

Permalink
Add overrides to more places
Browse files Browse the repository at this point in the history
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
  • Loading branch information
harshavamsi committed Aug 8, 2024
1 parent 6566923 commit ae85095
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public void testRangeQuery() throws IOException {
u,
includeLower,
includeUpper,
RewriteOverride.DEFAULT,
false,
true,
MOCK_QSC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,28 @@ public void testHalfFloatRange() throws IOException {
float u = (randomFloat() * 2 - 1) * 65504;
boolean includeLower = randomBoolean();
boolean includeUpper = randomBoolean();
Query floatQ = NumberType.FLOAT.rangeQuery("float", l, u, includeLower, includeUpper, false, true, MOCK_QSC);
Query halfFloatQ = NumberType.HALF_FLOAT.rangeQuery("half_float", l, u, includeLower, includeUpper, false, true, MOCK_QSC);
Query floatQ = NumberType.FLOAT.rangeQuery(
"float",
l,
u,
includeLower,
includeUpper,
RewriteOverride.DEFAULT,
false,
true,
MOCK_QSC
);
Query halfFloatQ = NumberType.HALF_FLOAT.rangeQuery(
"half_float",
l,
u,
includeLower,
includeUpper,
RewriteOverride.DEFAULT,
false,
true,
MOCK_QSC
);
assertEquals(searcher.count(floatQ), searcher.count(halfFloatQ));
}
IOUtils.close(reader, dir);
Expand Down Expand Up @@ -587,28 +607,39 @@ public void testUnsignedLongRange() throws IOException {
u,
includeLower,
includeUpper,
RewriteOverride.DEFAULT,
false,
true,
MOCK_QSC
);
Query doubleQ = NumberType.DOUBLE.rangeQuery(
"double",
l,
u,
includeLower,
includeUpper,
RewriteOverride.DEFAULT,
false,
true,
MOCK_QSC
);
Query doubleQ = NumberType.DOUBLE.rangeQuery("double", l, u, includeLower, includeUpper, false, true, MOCK_QSC);
assertEquals(searcher.count(doubleQ), searcher.count(unsignedLongQ));
}
IOUtils.close(reader, dir);
}

public void testNegativeZero() {
assertEquals(
NumberType.DOUBLE.rangeQuery("field", null, -0d, true, true, false, true, MOCK_QSC),
NumberType.DOUBLE.rangeQuery("field", null, +0d, true, false, false, true, MOCK_QSC)
NumberType.DOUBLE.rangeQuery("field", null, -0d, true, true, RewriteOverride.DEFAULT, false, true, MOCK_QSC),
NumberType.DOUBLE.rangeQuery("field", null, +0d, true, false, RewriteOverride.DEFAULT, false, true, MOCK_QSC)
);
assertEquals(
NumberType.FLOAT.rangeQuery("field", null, -0f, true, true, false, true, MOCK_QSC),
NumberType.FLOAT.rangeQuery("field", null, +0f, true, false, false, true, MOCK_QSC)
NumberType.FLOAT.rangeQuery("field", null, -0f, true, true, RewriteOverride.DEFAULT, false, true, MOCK_QSC),
NumberType.FLOAT.rangeQuery("field", null, +0f, true, false, RewriteOverride.DEFAULT, false, true, MOCK_QSC)
);
assertEquals(
NumberType.HALF_FLOAT.rangeQuery("field", null, -0f, true, true, false, true, MOCK_QSC),
NumberType.HALF_FLOAT.rangeQuery("field", null, +0f, true, false, false, true, MOCK_QSC)
NumberType.HALF_FLOAT.rangeQuery("field", null, -0f, true, true, RewriteOverride.DEFAULT, false, true, MOCK_QSC),
NumberType.HALF_FLOAT.rangeQuery("field", null, +0f, true, false, RewriteOverride.DEFAULT, false, true, MOCK_QSC)
);

assertFalse(NumberType.DOUBLE.termQuery("field", -0d, true, true).equals(NumberType.DOUBLE.termQuery("field", +0d, true, true)));
Expand Down Expand Up @@ -670,6 +701,7 @@ public void doTestDocValueRangeQueries(NumberType type, Supplier<Number> valueSu
random().nextBoolean() ? null : valueSupplier.get(),
randomBoolean(),
randomBoolean(),
RewriteOverride.DEFAULT,
true,
true,
MOCK_QSC
Expand Down Expand Up @@ -753,6 +785,7 @@ public void doTestIndexSortRangeQueries(NumberType type, Supplier<Number> valueS
random().nextBoolean() ? null : valueSupplier.get(),
randomBoolean(),
randomBoolean(),
RewriteOverride.DEFAULT,
true,
true,
context
Expand Down

0 comments on commit ae85095

Please sign in to comment.