Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Fixed
- Fix flaky test FieldDataLoadingIT.testIndicesFieldDataCacheSizeSetting ([#19571](https://github.com/opensearch-project/OpenSearch/pull/19571))
- Fix incorrect rewriting of terms query with more than 2 consecutive whole numbers
([#19587](https://github.com/opensearch-project/OpenSearch/pull/19587))

### Dependencies
- Bump `com.azure:azure-core-http-netty` from 1.15.12 to 1.16.1 ([#19533](https://github.com/opensearch-project/OpenSearch/pull/19533))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public static List<QueryBuilder> numberValuesToComplement(String fieldName, List
// If this is a whole number field and the last value is 1 less than the current value, we can skip this part of the
// complement
if (isWholeNumber && value.longValue() - lastValue.longValue() == 1) {
lastValue = value;
continue;
}
range.includeLower(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,15 @@ public void testGetComplementWholeNumber() throws Exception {
complement = queryBuilder.getComplement(createShardContext(searcher));
assertEquals(complement, expectedComplement);

// Test multiple consecutive values
queryBuilder = new TermsQueryBuilder(INT_FIELD_NAME, List.of("1", "2", "3"));
complement = queryBuilder.getComplement(createShardContext(searcher));
expectedComplement = List.of(
new RangeQueryBuilder(INT_FIELD_NAME).to(1).includeLower(true).includeUpper(false),
new RangeQueryBuilder(INT_FIELD_NAME).from(3).includeLower(false).includeUpper(true)
);
assertEquals(complement, expectedComplement);

// If zero values, we should get null
queryBuilder = new TermsQueryBuilder(INT_FIELD_NAME, List.of());
complement = queryBuilder.getComplement(createShardContext(searcher));
Expand Down
Loading