Skip to content

Commit d3ad5b8

Browse files
Use pack method for half_float and usigned_long (#19553)
* use pack methods Signed-off-by: Prudhvi Godithi <[email protected]> * update changelog Signed-off-by: Prudhvi Godithi <[email protected]> * update changelog Signed-off-by: Prudhvi Godithi <[email protected]> * Remove array creation Signed-off-by: Prudhvi Godithi <[email protected]> * Fix changelog Signed-off-by: Prudhvi Godithi <[email protected]> --------- Signed-off-by: Prudhvi Godithi <[email protected]>
1 parent b99c71d commit d3ad5b8

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55

66
## [Unreleased 3.x]
77
### Added
8+
- Use Lucene `pack` method for `half_float` and `usigned_long` when using `ApproximatePointRangeQuery`.
89

910
### Changed
1011
- Refactor to move prepareIndex and prepareDelete methods to Engine class ([#19551](https://github.com/opensearch-project/OpenSearch/pull/19551))

server/src/main/java/org/opensearch/index/mapper/NumberFieldMapper.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ public Query rangeQuery(
405405
query,
406406
new ApproximatePointRangeQuery(
407407
field,
408-
NumberType.HALF_FLOAT.encodePoint(l),
409-
NumberType.HALF_FLOAT.encodePoint(u),
408+
HalfFloatPoint.pack(l).bytes,
409+
HalfFloatPoint.pack(u).bytes,
410410
APPROX_QUERY_NUMERIC_DIMS,
411411
ApproximatePointRangeQuery.HALF_FLOAT_FORMAT
412412
)
@@ -604,8 +604,8 @@ public Query rangeQuery(
604604
query,
605605
new ApproximatePointRangeQuery(
606606
field,
607-
FloatPoint.pack(new float[] { l }).bytes,
608-
FloatPoint.pack(new float[] { u }).bytes,
607+
FloatPoint.pack(l).bytes,
608+
FloatPoint.pack(u).bytes,
609609
APPROX_QUERY_NUMERIC_DIMS,
610610
ApproximatePointRangeQuery.FLOAT_FORMAT
611611
)
@@ -778,8 +778,8 @@ public Query rangeQuery(
778778
query,
779779
new ApproximatePointRangeQuery(
780780
field,
781-
DoublePoint.pack(new double[] { l }).bytes,
782-
DoublePoint.pack(new double[] { u }).bytes,
781+
DoublePoint.pack(l).bytes,
782+
DoublePoint.pack(u).bytes,
783783
APPROX_QUERY_NUMERIC_DIMS,
784784
ApproximatePointRangeQuery.DOUBLE_FORMAT
785785
)
@@ -1228,8 +1228,8 @@ public Query rangeQuery(
12281228
query,
12291229
new ApproximatePointRangeQuery(
12301230
field,
1231-
IntPoint.pack(new int[] { l }).bytes,
1232-
IntPoint.pack(new int[] { u }).bytes,
1231+
IntPoint.pack(l).bytes,
1232+
IntPoint.pack(u).bytes,
12331233
APPROX_QUERY_NUMERIC_DIMS,
12341234
ApproximatePointRangeQuery.INT_FORMAT
12351235
)
@@ -1396,8 +1396,8 @@ public Query rangeQuery(
13961396
query,
13971397
new ApproximatePointRangeQuery(
13981398
field,
1399-
LongPoint.pack(new long[] { l }).bytes,
1400-
LongPoint.pack(new long[] { u }).bytes,
1399+
LongPoint.pack(l).bytes,
1400+
LongPoint.pack(u).bytes,
14011401
APPROX_QUERY_NUMERIC_DIMS,
14021402
ApproximatePointRangeQuery.LONG_FORMAT
14031403
)
@@ -1555,8 +1555,8 @@ public Query rangeQuery(
15551555
query,
15561556
new ApproximatePointRangeQuery(
15571557
field,
1558-
NumberType.UNSIGNED_LONG.encodePoint(l),
1559-
NumberType.UNSIGNED_LONG.encodePoint(u),
1558+
BigIntegerPoint.pack(l).bytes,
1559+
BigIntegerPoint.pack(u).bytes,
15601560
APPROX_QUERY_NUMERIC_DIMS,
15611561
ApproximatePointRangeQuery.UNSIGNED_LONG_FORMAT
15621562
)

0 commit comments

Comments
 (0)