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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Remove unnecessary iteration per-shard in request cache cleanup ([#19263](https://github.com/opensearch-project/OpenSearch/pull/19263))
- Fix derived field rewrite to handle range queries ([#19496](https://github.com/opensearch-project/OpenSearch/pull/19496))
- [WLM] add a check to stop workload group deletion having rules ([#19502](https://github.com/opensearch-project/OpenSearch/pull/19502))
- Fix incorrect rewriting of terms query with more than two consecutive whole numbers ([#19587](https://github.com/opensearch-project/OpenSearch/pull/19587))

### Dependencies
- Bump `com.gradleup.shadow:shadow-gradle-plugin` from 8.3.5 to 8.3.9 ([#19400](https://github.com/opensearch-project/OpenSearch/pull/19400))
Expand Down
1 change: 1 addition & 0 deletions release-notes/opensearch.release-notes-3.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Compatible with OpenSearch and OpenSearch Dashboards version 3.3.0
* Handle negative search request nodes stats ([#19340](https://github.com/opensearch-project/OpenSearch/pull/19340))
* Remove unnecessary iteration per-shard in request cache cleanup ([#19263](https://github.com/opensearch-project/OpenSearch/pull/19263))
* Fix derived field rewrite to handle range queries ([#19496](https://github.com/opensearch-project/OpenSearch/pull/19496))
* Fix incorrect rewriting of terms query with more than two consecutive whole numbers ([#19587](https://github.com/opensearch-project/OpenSearch/pull/19587))

### Dependencies
* Bump `com.gradleup.shadow:shadow-gradle-plugin` from 8.3.5 to 8.3.9 ([#19400](https://github.com/opensearch-project/OpenSearch/pull/19400))
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