feat: add Boost query API (Weaviate 1.38 Preview) - #355
Merged
Conversation
…ate methods Weaviate 1.38 Preview, gRPC-only. Adds the Boost model (filter, time_decay, numeric_decay, numeric_property conditions plus weighted blend), the Boost proto message + optional SearchRequest.boost field 62 (from the v1.38.4 server proto), request serialization in BuildBoost, and an optional boost parameter on every BM25/Hybrid/NearText/NearVector/NearObject/NearMedia overload of QueryClient, GenerateClient and the typed clients (FetchObjects excluded, matching python client PR #2030). All server defaults (weight 0.5, depth 100, curve exponential, decay 0.5) are left to the server via proto field presence; the only client-side default is time_decay origin=now.
Pre-1.38 servers silently ignore the boost proto field, so on CI's matrix
(<= 1.37.5) the asserted orderings would fail rather than skip. Each of the
five tests now calls RequireVersion("1.38.0") per repo convention.
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
Summary - Weaviate C# Client CoverageSummary
CoverageWeaviate.Client - 49.4%
Weaviate.Client.Analyzers - 0%
Weaviate.Client.VectorData - 50.3%
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the Weaviate 1.38 (Preview, gRPC-only) Boost soft-ranking API to the C# client by introducing a new Boost model, extending the gRPC proto/request builder to serialize it, and threading an optional boost parameter through the query/generate (including typed) surfaces, with unit + integration coverage.
Changes:
- Introduces
Models/Boost.cswith factory methods for filter/time-decay/numeric boosts and blending. - Extends gRPC
SearchRequestproto and request building to include the optionalboostfield and map model → proto. - Adds
boostparameters across relevant Query/Generate APIs (including typed clients) plus unit/integration tests verifying serialization and ranking behavior.
Reviewed changes
Copilot reviewed 30 out of 31 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Weaviate.Client/Typed/TypedQueryClient.NearVector.cs | Threads optional boost through typed NearVector query overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedQueryClient.NearText.cs | Threads optional boost through typed NearText query overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedQueryClient.NearObject.cs | Threads optional boost through typed NearObject query overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedQueryClient.NearMedia.cs | Threads optional boost through typed NearMedia query overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedQueryClient.Hybrid.cs | Adds optional boost to typed Hybrid query overloads. |
| src/Weaviate.Client/Typed/TypedQueryClient.BM25.cs | Adds optional boost to typed BM25 query overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedGenerateClient.NearVector.cs | Threads optional boost through typed NearVector generate overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedGenerateClient.NearText.cs | Threads optional boost through typed NearText generate overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedGenerateClient.NearObject.cs | Threads optional boost through typed NearObject generate overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedGenerateClient.NearMedia.cs | Threads optional boost through typed NearMedia generate overloads and XML docs. |
| src/Weaviate.Client/Typed/TypedGenerateClient.Hybrid.cs | Adds optional boost to typed Hybrid generate overloads. |
| src/Weaviate.Client/Typed/TypedGenerateClient.BM25.cs | Adds optional boost to typed BM25 generate overloads and XML docs. |
| src/Weaviate.Client/QueryClient.NearVector.cs | Adds optional boost to NearVector query overloads and passes through to gRPC. |
| src/Weaviate.Client/QueryClient.NearText.cs | Adds optional boost to NearText query overloads and passes through to gRPC. |
| src/Weaviate.Client/QueryClient.NearObject.cs | Adds optional boost to NearObject query overloads and passes through to gRPC. |
| src/Weaviate.Client/QueryClient.NearMedia.cs | Adds optional boost to NearMedia query overloads and passes through to gRPC. |
| src/Weaviate.Client/QueryClient.Hybrid.cs | Adds optional boost to Hybrid query overloads and passes through to gRPC. |
| src/Weaviate.Client/QueryClient.BM25.cs | Adds optional boost to BM25 query overloads and passes through to gRPC. |
| src/Weaviate.Client/GenerateClient.NearVector.cs | Adds optional boost to NearVector generate overloads and passes through to gRPC. |
| src/Weaviate.Client/GenerateClient.NearText.cs | Adds optional boost to NearText generate overloads and passes through to gRPC. |
| src/Weaviate.Client/GenerateClient.NearObject.cs | Adds optional boost to NearObject generate overloads and passes through to gRPC. |
| src/Weaviate.Client/GenerateClient.NearMedia.cs | Adds optional boost to NearMedia generate overloads and passes through to gRPC. |
| src/Weaviate.Client/GenerateClient.Hybrid.cs | Adds optional boost to Hybrid generate overloads and passes through to gRPC. |
| src/Weaviate.Client/GenerateClient.BM25.cs | Adds optional boost to BM25 generate overloads and passes through to gRPC. |
| src/Weaviate.Client/Models/Boost.cs | New public Boost model + factories and blend composition used by gRPC serialization. |
| src/Weaviate.Client/gRPC/Search.cs | Adds boost parameter plumbing through gRPC search entrypoints. |
| src/Weaviate.Client/gRPC/Search.Builders.cs | Adds BuildBoost + curve/modifier mapping and sets SearchRequest.Boost. |
| src/Weaviate.Client/gRPC/proto/v1/search_get.proto | Adds Boost message + optional Boost boost = 62 on SearchRequest. |
| src/Weaviate.Client.Tests/Unit/TestBoostSyntax.cs | Unit tests verifying boost proto serialization + field presence behavior. |
| src/Weaviate.Client.Tests/Integration/TestBoost.cs | Integration tests asserting ranking changes with boost (gated to 1.38+). |
# Conflicts: # src/Weaviate.Client/PublicAPI.Unshipped.txt
g-despot
added a commit
to Shaurya2k06/csharp-client
that referenced
this pull request
Aug 14, 2026
PR weaviate#358 was written against weaviate#355 (feat/boost-query-api), so its <param> tags describe that branch's API rather than main's: - `boost` does not exist on main, so 30 `<param name="boost">` tags document a parameter that is not there (CS1572). They belong with weaviate#355, which is the PR that introduces the parameter. - `diversitySelection` was added to the same 30 methods by weaviate#366 after this PR was written, and was left undocumented (CS1573). Drop the boost tags and document diversitySelection instead, placing each tag at the position its parameter occupies in the signature (after `bm25Operator` in the Hybrid overloads, `distance` in GenerateClient.NearVector, `offset` in the QueryClient.NearText extensions). Also align two style details the PR introduced: `<param name="client">` reads "The client" (26 instances repo-wide, none of "The query client"), and the two QueryClient.NearText extension blocks take the trailing period their prose-style neighbours all use. The worklist was derived from the compiler, not by hand: `dotnet build --no-incremental` now reports 0 CS1572 and 0 CS1573, and the normalized warning set is byte-identical to origin/main (55 unique warnings on both).
Brings in #359 (module endpoint/location), #365 (BM25Operator.AndCross + searchOperator on generate.bm25), #366 (diversitySelection across hybrid and the near* family), and #367 (multimodal vectorizer weights). All of the .cs overload files auto-merged: boost is inserted after `rerank` and diversitySelection after `bm25Operator`/before `autoLimit`, so the two parameter additions never collided. Verified structurally in both directions (merged-minus-boost == origin/main, merged-minus-diversitySelection/ searchOperator == the branch) rather than trusting the auto-merge. The only textual conflict was PublicAPI.Unshipped.txt, where both sides emit a *REMOVED* line plus a replacement signature for the same 102 overloads. Resolved to a deduplicated union (102 identical *REMOVED* lines collapsed), then adjudicated by the public API analyzer: 204 single-parameter signatures were stale (RS0017) and 102 combined signatures were missing (RS0016). After applying those, the RS0016/RS0017 sets are identical to both parents'. Parameter counts after the merge match each parent exactly: boost 111 declarations (as on the branch), diversitySelection 105 and searchOperator 10 (as on main).
trengrj
approved these changes
Aug 18, 2026
Two ways the client could build a boost the server would not apply.
ToDurationString formatted TimeSpan.TotalSeconds as a double, so small or
negative spans became "5E-05s" or "-2592000s". The server's duration pattern
accepts neither sign nor exponent, and an unparseable time_decay scale is
dropped silently rather than rejected, leaving a successful query with the
boost disabled. Format from Ticks instead: a TimeSpan is an integer tick
count and a tick is 1e-7s, so every value has an exact decimal-seconds form
and no rounding step exists. Accepted output is unchanged. A non-positive
scale and a negative offset now throw, since neither can produce a usable
boost; a zero offset stays valid and means "decay immediately", matching the
server's behaviour when the field is omitted.
The Boost factories also passed property names to the wire verbatim while
Filter.Property lower-cases them, so the two arms of a single blend
disagreed on casing and Boost.NumericProperty("Rating_number") failed at
runtime against a property Filter.Property resolved fine.
weight: 0.7 did not compile. C# has no implicit double-to-float conversion, so every call site carried an f suffix while the numeric decay origin and scale sitting beside it took plain doubles, because the proto types differ there. The public surface now takes double for weight and decay throughout, and narrows to float in BuildBoost, the one place the wire requires it. Keeping the model in double also stops the record's ToString and Equals from reporting a value the caller never typed. Blend now accepts a single boost as well as a collection, matching the Python client. Both changes are breaking and are free only while the type is unshipped.
dirkkul
approved these changes
Aug 18, 2026
g-despot
added a commit
that referenced
this pull request
Aug 18, 2026
Boost (#355) landed on main and overlapped this branch in two files. gRPC/Search.Builders.cs auto-merged: boost added BuildBoost and its call sites, we added the deepseek runtime-provider mapping, and the two do not touch the same lines. Verified structurally rather than by eye — stripping main's side from the merged file reproduces our base->branch delta exactly, and stripping ours reproduces main's. PublicAPI.Unshipped.txt was the only real conflict. Boost rewrote ~50 overload signatures, so it removed 102 base lines and added 132; we added 106 and removed none. The two sets are disjoint: nothing we added was removed by boost, nothing boost added was removed by us. Resolved as the union — boost's file plus our 106 lines — and then handed to the analyzer rather than trusted: RS0016 192, RS0017 16, RS0025 0, all identical to what origin/main reports on its own, so our entries introduce no missing or stale declarations. PublicAPI.Shipped.txt did not move between the merge base and origin/main, so our *REMOVED* lines still name signatures that exist. Unit tests account for both sides exactly: main 946 -> 985 with boost's 39, and 985 -> 997 with our 12.
g-despot
added a commit
to Shaurya2k06/csharp-client
that referenced
this pull request
Aug 18, 2026
main added a boost parameter to the query and generate methods (weaviate#355), which lands in the same XML doc blocks this branch rewrote. Two files conflicted, QueryClient.NearText and GenerateClient.NearVector, and both are resolved by keeping both sides: main's boost parameter and the branch's parameter descriptions. Where main documented boost, its text is replaced by the description this branch uses for the parameter, so the surface reads with one voice.
g-despot
added a commit
to Shaurya2k06/csharp-client
that referenced
this pull request
Aug 18, 2026
The XML param gate this branch adds requires a <param> tag for every parameter of a documented public method. main documents boost on some of the methods that took it in weaviate#355 and not on others, so the six Hybrid, NearText and NearVector partials were left with 30 undocumented boost parameters — the branch's own check would have failed on main's code. Every boost parameter now carries the same description, taken from the summary on Boost itself: it re-scores the candidate pool the search fetches rather than excluding anything, nothing is boosted when it is left unset, and a server older than 1.38 ignores it silently. That last point is the one a caller cannot otherwise see, since the query still succeeds and only the ranking is wrong. 106 tags across 24 files, replacing the 68 shorter ones main carried.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Boostmodel withFilter,TimeDecay,NumericDecay,NumericProperty, andBlendfactories plusCurve/Modifierenums; optionalboostparameter on every BM25/Hybrid/Near* query and generate overload, including the typed clients (FetchObjectsexcluded, matching Python).Boostmessage +optional Boost boost = 62onSearchRequest, taken from the server v1.38.4 tag.time_decayorigin = "now".