Skip to content

feat: support the search API (alpha) from Dapr 1.19 - #1903

Open
AdepuSriCharan wants to merge 4 commits into
dapr:masterfrom
AdepuSriCharan:feat/search-alpha1
Open

AdepuSriCharan wants to merge 4 commits into
dapr:masterfrom
AdepuSriCharan:feat/search-alpha1

Conversation

@AdepuSriCharan

@AdepuSriCharan AdepuSriCharan commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds support for the Search API (alpha) introduced in Dapr 1.19.

This is the second and last part of #1879; the vector part was merged in #1901. It follows the approved approach: vector first, then search, with the same structure.

The changes include:

  • New DaprPreviewClient methods for creating, reading, listing and deleting indexes, managing documents, and searching with a text or native query, a filter, sorting and pagination.
  • A package-private DaprSearchClient using DaprGrpcCalls, with domain types that keep generated protobuf classes out of the public API. As in vector, Search is added where the proto name is generic, for example IndexSearchDocumentsRequestAlpha1 for IndexDocumentsRequestAlpha1.
  • A package-private SearchVectorHelper for the validation and mapping that search and vector share, moved out of DaprVectorClient in its own commit.
  • Request validation and error handling for invalid responses. A document that isn't a JSON object stays a per-item failure from the sidecar.
  • SearchDocument content is a byte[] holding a UTF-8 JSON object, as in the proto and the Go SDK. It doesn't go through the client's DaprObjectSerializer, which can be replaced with a non-JSON one, while the sidecar requires a JSON object.
  • A blank byText query is rejected, because the sidecar would run it as match-all. SearchQuery.matchAll() asks for that explicitly.
  • IndexingWaitTimeoutAction.FAIL_REQUEST documents that with client retries on, RetryPolicy sends the write again after DEADLINE_EXCEEDED.
  • Unit tests, a Testcontainers integration test using search.in-memory, and a working example.

Fix to the vector code from #1901: numbers in filters and metadata now keep their value. Before, 1.1f was sent as 1.100000023841858, so it missed a stored 1.1, and the long 9007199254740993 matched a record holding 9007199254740992. Now a float is sent through its decimal form, and NaN, infinities and numbers a double can't hold exactly are rejected with an IllegalArgumentException.

Testing:

  • Full Maven build passed on JDK 17, with 670 SDK tests and no Checkstyle violations.
  • SpotBugs reported no issues in the SDK and examples.
  • Search integration tests passed (10/10) and vector integration tests passed (5/5) against daprd 1.19.1; the conversation integration tests still pass.
  • The search, vector and conversation examples passed mechanical-markdown validation against daprd 1.19.0.

Issue reference

Closes #1879. The dapr/docs update follows in a separate PR.

Checklist

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation — the dapr/docs update will follow in a separate PR.

Signed-off-by: Adepu Sri Charan <sricharan.adepu36@gmail.com>
Signed-off-by: Adepu Sri Charan <sricharan.adepu36@gmail.com>
The check compared a number only with the double's shortest decimal form, so exact values such as 2^60 and Long.MIN_VALUE were rejected. A number is now accepted when it equals either the double's binary value or its decimal form.

Adds unit tests for the number conversion in vector and search.

Signed-off-by: Adepu Sri Charan <sricharan.adepu36@gmail.com>
@AdepuSriCharan
AdepuSriCharan requested review from a team as code owners November 10, 2026 10:42
Copilot AI balanced review requested due to automatic review settings November 10, 2026 10:42

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI 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.

🟡 Changes recommended

A moderate active issue remains in SearchVectorHelper: non-finite Double and Float values bypass validation and can be serialized as invalid protobuf Struct numbers.

1 open issue

Review effort: Lite

The sidecar accepts NaN and the infinities without an error, and a filter holding one matches the wrong records: on the in-memory stores, n < Infinity matched nothing. Double and Float now get the same finite check as the other number types.

Signed-off-by: Adepu Sri Charan <sricharan.adepu36@gmail.com>
Copilot AI lite review requested due to automatic review settings November 10, 2026 16:46

Copilot AI 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.

🟢 Approval recommended

No active review issues are present, and the change is supported by unit, integration, and CI validation covering the new Search API and shared Vector functionality.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@codecov

codecov Bot commented Nov 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.38776% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.50%. Comparing base (e2e5b3c) to head (af46450).

Files with missing lines Patch % Lines
...c/main/java/io/dapr/client/SearchVectorHelper.java 96.55% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1903      +/-   ##
============================================
+ Coverage     81.92%   82.50%   +0.58%     
- Complexity     3644     3829     +185     
============================================
  Files           329      344      +15     
  Lines         11340    11720     +380     
  Branches       1290     1325      +35     
============================================
+ Hits           9290     9670     +380     
  Misses         1556     1556              
  Partials        494      494              

☔ View full report in Codecov by Harness.
📢 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.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support the search and vector APIs (alpha) from Dapr 1.19

2 participants