Skip to content

[GRPC] Implement Boosting and SimpleQueryString queries - #20487

Open
karenyrx wants to merge 2 commits into
opensearch-project:mainfrom
karenyrx:boostingsimplequery
Open

[GRPC] Implement Boosting and SimpleQueryString queries#20487
karenyrx wants to merge 2 commits into
opensearch-project:mainfrom
karenyrx:boostingsimplequery

Conversation

@karenyrx

Copy link
Copy Markdown
Contributor

Description

Paired with opensearch-project/opensearch-protobufs#376

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@coderabbitai

coderabbitai Bot commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR upgrades the opensearchprotobufs dependency from 1.2.0 to 1.3.0 and introduces gRPC proto converter implementations for BoostingQuery and SimpleQueryString queries, including comprehensive utilities and unit tests. Error message constants are extracted into query builder classes for reusability across proto and XContent parsing paths.

Changes

Cohort / File(s) Summary
Dependency and Changelog Updates
CHANGELOG.md, gradle/libs.versions.toml, modules/transport-grpc/licenses/protobufs-*.jar.sha1, modules/transport-grpc/spi/licenses/protobufs-*.jar.sha1
Bumped opensearchprotobufs from 1.2.0 to 1.3.0, updated corresponding checksum/license files, and documented new features in changelog including proto converters and utilities.
BoostingQuery Proto Converters
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverter.java, BoostingQueryBuilderProtoUtils.java
New converter and utility classes to transform protobuf BoostingQuery messages into OpenSearch BoostingQueryBuilder objects, with validation of required positive/negative queries and negativeBoost value.
SimpleQueryString Proto Converters
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverter.java, SimpleQueryStringBuilderProtoUtils.java
New converter and utility classes to transform protobuf SimpleQueryStringQuery into SimpleQueryStringBuilder, including comprehensive flag parsing (with single/multiple flag support), field boost handling, and fuzzy parameter mapping.
Proto Converter Registry
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryImpl.java
Registered two new built-in converters (BoostingQueryBuilderProtoConverter and SimpleQueryStringBuilderProtoConverter) during initialization.
BoostingQuery Builder Constants
server/src/main/java/org/opensearch/index/query/BoostingQueryBuilder.java
Added three public static error message constants (POSITIVE_QUERY_REQUIRED, NEGATIVE_QUERY_REQUIRED, NEGATIVE_BOOST_POSITIVE_VALUE_REQUIRED) and replaced hard-coded strings in fromXContent.
SimpleQueryString Builder Constants
server/src/main/java/org/opensearch/index/query/SimpleQueryStringBuilder.java, SimpleQueryStringFlag.java
Added QUERY_TEXT_MISSING and UNKNOWN_FLAG_PREFIX constants, and updated error messages in constructor, fromXContent, and flag resolution to use constants.
gRPC Proto Converter Tests
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverterTests.java, SimpleQueryStringBuilderProtoConverterTests.java
Unit tests validating converter behavior, handled query cases, proto-to-builder conversion, and error handling for invalid/null inputs.
gRPC Proto Utility Tests
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtilsTests.java, SimpleQueryStringBuilderProtoUtilsTests.java
Comprehensive unit tests covering full/minimal field mapping, error cases, flag handling, nested queries, fuzzy parameters, and edge cases for proto conversion utilities.

Sequence Diagram

sequenceDiagram
    participant Client
    participant Converter as QueryBuilderProtoConverter
    participant Registry as ProtoConverterRegistry
    participant Utils as ProtoUtils
    participant Builder as QueryBuilder

    Client->>Converter: fromProto(QueryContainer)
    activate Converter
    Converter->>Converter: Validate input type
    Converter->>Utils: fromProto(Query, Registry)
    activate Utils
    Utils->>Registry: convertToQueryBuilder(positiveQuery)
    activate Registry
    Registry->>Converter: recursively convert sub-queries
    Converter-->>Registry: QueryBuilder result
    deactivate Registry
    Utils->>Registry: convertToQueryBuilder(negativeQuery)
    activate Registry
    Registry->>Converter: recursively convert sub-queries
    Converter-->>Registry: QueryBuilder result
    deactivate Registry
    Utils->>Utils: Validate parameters & flags
    Utils->>Builder: Construct QueryBuilder
    Builder-->>Utils: QueryBuilder instance
    deactivate Utils
    Utils-->>Converter: QueryBuilder
    Converter-->>Client: QueryBuilder result
    deactivate Converter
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~35 minutes

Possibly related PRs

Suggested labels

feature, v3.5.0

🚥 Pre-merge checks | ✅ 2 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete. It references a paired PR but lacks a detailed explanation of what the change achieves, the rationale, or the scope of implementation. Expand the description section with details on what Boosting and SimpleQueryString queries do, how they integrate with gRPC, and the overall scope of the implementation changes.
Docstring Coverage ⚠️ Warning Docstring coverage is 17.74% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title '[GRPC] Implement Boosting and SimpleQueryString queries' clearly and specifically summarizes the main change—implementing two new query types for gRPC transport.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

❌ Gradle check result for e8fc397: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@karenyrx karenyrx changed the title [GRPC] Implement Boosting and BimpleQueryString queries [GRPC] Implement Boosting and SImpleQueryString queries Jan 27, 2026
@karenyrx karenyrx changed the title [GRPC] Implement Boosting and SImpleQueryString queries [GRPC] Implement Boosting and SimpleQueryString queries Jan 27, 2026
@karenyrx
karenyrx force-pushed the boostingsimplequery branch from cfa2d46 to 295dd80 Compare January 27, 2026 23:41
@github-actions

Copy link
Copy Markdown
Contributor

❌ Gradle check result for 295dd80: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions

github-actions Bot commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

❌ Gradle check result for b14bdbb: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@karenyrx
karenyrx force-pushed the boostingsimplequery branch 3 times, most recently from d01c912 to 93b322b Compare February 17, 2026 01:56
@github-actions

Copy link
Copy Markdown
Contributor

❗ AI-powered Code-Diff-Analyzer found issues on commit 93b322b.

PathLineSeverityDescription
modules/transport-grpc/build.gradle48highCustom Maven repository added (https://ci.opensearch.org/ci/dbc/snapshots/maven/) - potential supply chain attack vector. The path component 'dbc' is unusual and non-standard. If this repository is compromised or serves malicious artifacts, it could introduce backdoored dependencies. Verify this is an official OpenSearch repository and the artifact checksums (a141d00a9de80085436c648502d1b015fd89b9f6) match official releases.

The table above displays the top 10 most important findings.

Total: 1 | Critical: 0 | High: 1 | Medium: 0 | Low: 0


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

@karenyrx
karenyrx force-pushed the boostingsimplequery branch from 93b322b to 29ff77c Compare February 17, 2026 02:02
@github-actions

Copy link
Copy Markdown
Contributor

❗ AI-powered Code-Diff-Analyzer found issues on commit 29ff77c.

PathLineSeverityDescription
modules/transport-grpc/build.gradle48highSuspicious Maven repository added: 'https://ci.opensearch.org/ci/dbc/snapshots/maven/'. Snapshot repositories are mutable and can be modified post-release, creating a supply chain attack vector. The path '/ci/dbc/' is unusual and should be verified as legitimate. If this domain is compromised or the URL is incorrect, malicious dependencies could be pulled into the build.
modules/transport-grpc/spi/build.gradle26highSuspicious Maven repository added: 'https://ci.opensearch.org/ci/dbc/snapshots/maven/'. This is the second occurrence of the same repository URL. Snapshot repositories are mutable and represent a supply chain risk. The deliberate addition in multiple locations suggests intentionality, but the unusual path structure and snapshot nature warrant verification that this is a legitimate OpenSearch infrastructure endpoint.

The table above displays the top 10 most important findings.

Total: 2 | Critical: 0 | High: 2 | Medium: 0 | Low: 0


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

@karenyrx
karenyrx force-pushed the boostingsimplequery branch from 29ff77c to 3661cef Compare February 17, 2026 02:08
@github-actions

Copy link
Copy Markdown
Contributor

❗ AI-powered Code-Diff-Analyzer found issues on commit 3661cef.

PathLineSeverityDescription
gradle/libs.versions.toml27mediumDependency version update from opensearchprotobufs 1.2.0 to 1.3.0 with new SHA1 hashes. While the accompanying code changes appear legitimate, dependency updates are a common supply chain attack vector and the new JAR contents should be verified against official sources.

The table above displays the top 10 most important findings.

Total: 1 | Critical: 0 | High: 0 | Medium: 1 | Low: 0


Pull Requests Author(s): Please update your Pull Request according to the report above.

Repository Maintainer(s): You can bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions. To re-enable the analyzer, remove the label, then re-run all actions.


⚠️ Note: The Code-Diff-Analyzer helps protect against potentially harmful code patterns. Please ensure you have thoroughly reviewed the changes beforehand.

Thanks.

@karenyrx karenyrx added the skip-diff-analyzer Maintainer to skip code-diff-analyzer check, after reviewing issues in AI analysis. label Feb 17, 2026
@karenyrx

Copy link
Copy Markdown
Contributor Author

Skipping the diff analyzer as the protobufs version upgrade is legitimate, and comment recommended to "bypass diff analyzer by adding label skip-diff-analyzer after reviewing the changes carefully, then re-run failed actions."

Screenshot 2026-02-16 at 9 15 09 PM

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6760346 and 3661cef.

📒 Files selected for processing (18)
  • CHANGELOG.md
  • gradle/libs.versions.toml
  • modules/transport-grpc/licenses/protobufs-1.2.0.jar.sha1
  • modules/transport-grpc/licenses/protobufs-1.3.0.jar.sha1
  • modules/transport-grpc/spi/licenses/protobufs-1.2.0.jar.sha1
  • modules/transport-grpc/spi/licenses/protobufs-1.3.0.jar.sha1
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverter.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryImpl.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverter.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverterTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverterTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtilsTests.java
  • server/src/main/java/org/opensearch/index/query/BoostingQueryBuilder.java
  • server/src/main/java/org/opensearch/index/query/SimpleQueryStringBuilder.java
  • server/src/main/java/org/opensearch/index/query/SimpleQueryStringFlag.java
💤 Files with no reviewable changes (2)
  • modules/transport-grpc/licenses/protobufs-1.2.0.jar.sha1
  • modules/transport-grpc/spi/licenses/protobufs-1.2.0.jar.sha1
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: The gRPC search API in OpenSearch is marked as "experimental" in official documentation, so changes to proto schemas that remove previously unsupported fields (those throwing UnsupportedOperationException) are not considered breaking changes.
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.
📚 Learning: 2026-01-02T19:23:29.698Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: In the transport-grpc module, suggest and aggregations protos were removed from SearchRequestBody in protobufs 1.0.0 because they haven't been vetted for accuracy in the API specification. The URL parameter suggest support (suggest_field, suggest_mode, suggest_size, suggest_text) is a minimized subset and not intended as a replacement for full Suggester functionality.

Applied to files:

  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverter.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverterTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryImpl.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverter.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtils.java
📚 Learning: 2026-01-02T19:23:16.689Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:16.689Z
Learning: In OpenSearch's gRPC transport module, treat removals of previously-unsupported fields (those throwing UnsupportedOperationException) from experimental proto schemas as non-breaking changes. When reviewing changes to proto-related Java code in this module, document that such removals do not count as breaking API changes, and ensure tests reflect compatibility expectations accordingly.

Applied to files:

  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverter.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverterTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtils.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverterTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryImpl.java
  • modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtilsTests.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverter.java
  • modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtils.java
📚 Learning: 2026-01-13T17:40:27.167Z
Learnt from: reta
Repo: opensearch-project/OpenSearch PR: 20411
File: server/src/main/java/org/opensearch/index/codec/CodecService.java:112-133
Timestamp: 2026-01-13T17:40:27.167Z
Learning: Avoid capturing or evaluating a supplier (e.g., this::defaultCodec) upfront when passing it to a registry during object construction. If registries may replace defaults during iteration (as in EnginePlugin.getAdditionalCodecs), pass the supplier itself and only resolve it at use time. This ensures dynamic behavior is preserved during initialization and prevents premature binding of defaults in codecs/registry setup. This pattern should apply to similar initialization paths in Java server code where registries may mutate defaults during construction.

Applied to files:

  • server/src/main/java/org/opensearch/index/query/BoostingQueryBuilder.java
  • server/src/main/java/org/opensearch/index/query/SimpleQueryStringBuilder.java
  • server/src/main/java/org/opensearch/index/query/SimpleQueryStringFlag.java
📚 Learning: 2026-01-02T19:23:29.698Z
Learnt from: karenyrx
Repo: opensearch-project/OpenSearch PR: 20335
File: modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/SearchSourceBuilderProtoUtils.java:155-172
Timestamp: 2026-01-02T19:23:29.698Z
Learning: The gRPC search API in OpenSearch is marked as "experimental" in official documentation, so changes to proto schemas that remove previously unsupported fields (those throwing UnsupportedOperationException) are not considered breaking changes.

Applied to files:

  • CHANGELOG.md
🧬 Code graph analysis (7)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverter.java (1)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtils.java (1)
  • BoostingQueryBuilderProtoUtils (22-85)
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverterTests.java (1)
server/src/main/java/org/opensearch/index/query/BoostingQueryBuilder.java (1)
  • BoostingQueryBuilder (63-270)
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtilsTests.java (3)
server/src/main/java/org/opensearch/index/query/BoostingQueryBuilder.java (1)
  • BoostingQueryBuilder (63-270)
server/src/main/java/org/opensearch/index/query/TermQueryBuilder.java (1)
  • TermQueryBuilder (57-251)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtils.java (1)
  • BoostingQueryBuilderProtoUtils (22-85)
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverterTests.java (1)
server/src/main/java/org/opensearch/index/query/SimpleQueryStringBuilder.java (1)
  • SimpleQueryStringBuilder (91-621)
modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtilsTests.java (1)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtils.java (1)
  • SimpleQueryStringBuilderProtoUtils (25-302)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverter.java (1)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtils.java (1)
  • SimpleQueryStringBuilderProtoUtils (25-302)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtils.java (3)
server/src/main/java/org/opensearch/index/query/AbstractQueryBuilder.java (1)
  • AbstractQueryBuilder (69-424)
server/src/main/java/org/opensearch/index/query/SimpleQueryStringBuilder.java (1)
  • SimpleQueryStringBuilder (91-621)
modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/OperatorProtoUtils.java (1)
  • OperatorProtoUtils (18-39)
🪛 markdownlint-cli2 (0.20.0)
CHANGELOG.md

[warning] 62-62: Link and image reference definitions should be needed
Duplicate link or image reference definition: "unreleased 3.x"

(MD053, link-image-reference-definitions)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: gradle-check
🔇 Additional comments (49)
modules/transport-grpc/licenses/protobufs-1.3.0.jar.sha1 (1)

1-1: LGTM — checksum file added as expected.
The single-line SHA-1 entry looks correct for a checksum artifact.

modules/transport-grpc/spi/licenses/protobufs-1.3.0.jar.sha1 (1)

1-1: LGTM — checksum file added as expected.
The single-line SHA-1 entry looks correct for a checksum artifact.

server/src/main/java/org/opensearch/index/query/BoostingQueryBuilder.java (1)

197-205: Consistent parsing messages.

Using shared constants in fromXContent keeps validation messages aligned across parsing paths.

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtils.java (1)

182-301: Flags helpers look solid.

The conversion helpers mirror SimpleQueryStringFlag behavior and keep the proto path aligned with server semantics.

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverter.java (1)

39-46: Clear validation and delegation.

The converter checks container type and cleanly delegates to the utils implementation.

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverter.java (1)

39-46: LGTM.

Clear container validation and clean delegation to the utils.

modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/QueryBuilderProtoConverterRegistryImpl.java (1)

72-73: Registry wiring looks good.

New converters are registered alongside existing built-ins in the expected initialization flow.

server/src/main/java/org/opensearch/index/query/SimpleQueryStringFlag.java (1)

90-90: Consistent error messaging.

Using the shared prefix keeps unknown-flag errors aligned across parsing paths.

server/src/main/java/org/opensearch/index/query/SimpleQueryStringBuilder.java (1)

111-113: Consistent error messaging via shared constants.

Nice consolidation of validation messages across constructor and XContent parsing.

Also applies to: 159-161, 579-582

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoConverterTests.java (5)

18-24: Clean test setup.


26-33: Handled query case test looks good.


35-56: Happy-path conversion assertions are solid.


58-69: Invalid container guardrail is covered.


72-81: Null container case is covered.

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoConverterTests.java (5)

21-30: Setup wiring is clear and sufficient.


32-35: Handled query case test is straightforward.


37-64: Happy-path conversion assertions are solid.


66-78: Invalid container behavior is covered.


80-89: Null container behavior is covered.

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtilsTests.java (19)

22-54: Baseline conversion coverage is thorough.


56-111: Full-field mapping test is comprehensive.


113-124: Missing query validation test is solid.


126-137: Empty query validation test is solid.


139-153: Field parsing without boosts is covered.


155-167: Invalid boost notation behavior is tested.


169-198: Single-flag handling coverage looks good.


200-211: Multiple flags (pipe-delimited) case covered.


213-223: ALL flag handling covered.


225-235: NONE flag handling covered.


237-252: Invalid flags error path covered.


254-263: Minimum-should-match int mapping covered.


265-274: Minimum-should-match string mapping covered.


276-285: Default operator OR mapping covered.


287-296: Default operator AND mapping covered.


298-308: Empty flags string defaulting covered.


310-320: Flags parsing with spaces covered.


322-331: Empty fields list defaulting covered.


333-346: Fuzzy settings mapping covered.

modules/transport-grpc/src/test/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtilsTests.java (11)

23-30: Setup is clean and focused.


32-61: All-fields conversion test is comprehensive.


63-81: Minimal-fields conversion test is solid.


83-102: Missing positive query validation is covered.


104-120: Missing negative query validation is covered.


122-134: Zero negative-boost behavior is covered.


136-155: Negative negative-boost validation is covered.


157-173: Boost-only mapping test is solid.


175-191: Name-only mapping test is solid.


193-231: Complex nested queries mapping is well tested.


233-242: Helper builders keep tests tidy.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CHANGELOG.md`:
- Around line 15-29: The CHANGELOG.md includes many unrelated "Added" bullets;
trim this section to only the entries introduced by this PR (specifically keep
the "- Implement gRPC Boosting and SimpleQueryString queries ([`#20487`])" entry)
and remove or move other unrelated bullets (e.g., items like HTTP/3, netty4,
tracing, index-level-encryption, etc.) so the release notes accurately reflect
only the changes in this PR; update the "Added" list to contain just the PR
20487 entry (or any directly related entries) and, if needed, reference or
relocate the other entries to their respective PR changelogs.
- Around line 59-62: The CHANGELOG.md contains duplicate reference definitions
for the label "[Unreleased 3.x]"; remove the redundant reference block so only a
single "[Unreleased 3.x]:" reference remains (update the remaining definition to
the correct compare range as needed) and ensure all occurrences of the label
resolve to that single definition.

In `@gradle/libs.versions.toml`:
- Line 27: The dependency version for the opensearch protobufs artifact is
invalid: update the opensearchprotobufs entry in gradle/libs.versions.toml to a
version that exists on Maven Central (e.g., change "1.3.0" to a published
version such as "1.1.0") or wait until the desired release is published, and
ensure the chosen version matches the published artifact in Maven Central per
the transport-grpc README workflow; verify by checking Maven Central for
org.opensearch:protobufs before committing.

In
`@modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/BoostingQueryBuilderProtoUtils.java`:
- Around line 47-65: The proto fields are not presence-checked before
conversion, so add guards in BoostingQueryBuilderProtoUtils: call
boostingQueryProto.hasPositive() and if false throw new
IllegalArgumentException(BoostingQueryBuilder.POSITIVE_QUERY_REQUIRED) before
invoking registry.fromProto(positiveContainer); do the same for
boostingQueryProto.hasNegative() with
BoostingQueryBuilder.NEGATIVE_QUERY_REQUIRED; for negativeBoost, check
boostingQueryProto.hasNegativeBoost() and throw
BoostingQueryBuilder.NEGATIVE_BOOST_POSITIVE_VALUE_REQUIRED if missing, then
read negativeBoost and validate it is > 0 (throw the same constant if <= 0);
after registry.fromProto(...) still validate the returned QueryBuilder is not
null and throw the same respective REQUIRED constant if it is.

In
`@modules/transport-grpc/src/main/java/org/opensearch/transport/grpc/proto/request/search/query/SimpleQueryStringBuilderProtoUtils.java`:
- Around line 63-83: The proto validation currently rejects empty query strings
(using SimpleQueryStringBuilder.QUERY_TEXT_MISSING) and silently defaults
invalid "field^boost" values to AbstractQueryBuilder.DEFAULT_BOOST; change it to
mirror server XContent behavior: only reject null queryBody (do not treat empty
as missing) and when processing fields in simpleQueryStringProto.getFieldsList()
(populating fieldsAndWeights) throw on invalid boost formats instead of
defaulting—i.e., on NumberFormatException for the boost part, rethrow an
IllegalArgumentException (or propagate a parsing exception consistent with
QueryParserHelper.parseFieldsAndWeights) so invalid boosts are reported rather
than replaced silently.

In `@server/src/main/java/org/opensearch/index/query/BoostingQueryBuilder.java`:
- Around line 66-70: In BoostingQueryBuilder, three error message constants
(POSITIVE_QUERY_REQUIRED, NEGATIVE_QUERY_REQUIRED,
NEGATIVE_BOOST_POSITIVE_VALUE_REQUIRED) include an extra trailing single-quote
character; remove the trailing "'" from each string literal so the messages read
correctly without the stray quote, keeping the rest of the text unchanged and
ensuring the constants remain public static final Strings.

Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread gradle/libs.versions.toml
Comment thread server/src/main/java/org/opensearch/index/query/BoostingQueryBuilder.java Outdated
@github-actions

Copy link
Copy Markdown
Contributor

❌ Gradle check result for 3661cef: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@github-actions

Copy link
Copy Markdown
Contributor

❌ Gradle check result for 3661cef: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Signed-off-by: Karen X <karenxyr@gmail.com>
@karenyrx
karenyrx force-pushed the boostingsimplequery branch from 3661cef to 1799143 Compare February 17, 2026 18:29
Signed-off-by: Karen X <karenxyr@gmail.com>
@karenyrx
karenyrx force-pushed the boostingsimplequery branch from 20ec154 to 213f2cd Compare February 17, 2026 19:15
@github-actions

Copy link
Copy Markdown
Contributor

❕ Gradle check result for 213f2cd: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@codecov

codecov Bot commented Feb 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.75145% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.35%. Comparing base (db0a16d) to head (213f2cd).
⚠️ Report is 215 commits behind head on main.

Files with missing lines Patch % Lines
...arch/query/SimpleQueryStringBuilderProtoUtils.java 90.83% 4 Missing and 7 partials ⚠️
...g/opensearch/index/query/BoostingQueryBuilder.java 0.00% 3 Missing ⚠️
...ensearch/index/query/SimpleQueryStringBuilder.java 50.00% 1 Missing ⚠️
.../opensearch/index/query/SimpleQueryStringFlag.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #20487      +/-   ##
============================================
+ Coverage     73.19%   73.35%   +0.15%     
- Complexity    71924    72098     +174     
============================================
  Files          5781     5785       +4     
  Lines        329292   329559     +267     
  Branches      47514    47560      +46     
============================================
+ Hits         241026   241732     +706     
+ Misses        68925    68429     -496     
- Partials      19341    19398      +57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread CHANGELOG.md Outdated
- Add indices to search request slowlog ([#20588](https://github.com/opensearch-project/OpenSearch/pull/20588))
- Add support for fields containing dots in their name as literals ([#19958](https://github.com/opensearch-project/OpenSearch/pull/19958))
- Add support for forward translog reading ([#20163](https://github.com/opensearch-project/OpenSearch/pull/20163))
- Added public getter method in `SourceFieldMapper` to return excluded field ([#20205](https://github.com/opensearch-project/OpenSearch/pull/20205))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should remove these?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, was removed in an earlier commit!

@varunbharadwaj varunbharadwaj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall

// Note: XContent only checks for null (allows empty strings)
// Proto strings are never null (default to empty), so this check will never trigger
// but we keep it for consistency with XContent pattern
if (queryBody == null) {

@varunbharadwaj varunbharadwaj Feb 28, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it'll never be null and default to empty, should we check for empty string instead here?

* @return Array of SimpleQueryStringFlag
*/
private static SimpleQueryStringFlag[] convertIntToFlags(int flagsValue) {
if (flagsValue == -1) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would something like flagsValue == SimpleQueryStringFlag.ALL.value() be better here?

SimpleQueryStringFlag flag = SimpleQueryStringFlag.valueOf(s.toUpperCase(java.util.Locale.ROOT));
switch (flag) {
case NONE:
return 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here - use enum to retrieve the values?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-diff-analyzer Maintainer to skip code-diff-analyzer check, after reviewing issues in AI analysis.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants