Skip to content

Commit

Permalink
MB-62230: Added params in KNN request when parsing a query (#2071)
Browse files Browse the repository at this point in the history
This PR adds support for search-time params in the query parser and
custom JSON unmarshaling logic.
  • Loading branch information
metonymic-smokey authored Sep 17, 2024
1 parent 94175cf commit 58c4214
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions search_knn.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func (r *SearchRequest) UnmarshalJSON(input []byte) error {
VectorBase64 string `json:"vector_base64"`
K int64 `json:"k"`
Boost *query.Boost `json:"boost,omitempty"`
Params json.RawMessage `json:"params"`
FilterQuery json.RawMessage `JSON:"filter,omitempty"`
}

Expand Down Expand Up @@ -196,6 +197,7 @@ func (r *SearchRequest) UnmarshalJSON(input []byte) error {
r.KNN[i].VectorBase64 = temp.KNN[i].VectorBase64
r.KNN[i].K = temp.KNN[i].K
r.KNN[i].Boost = temp.KNN[i].Boost
r.KNN[i].Params = temp.KNN[i].Params
if len(knnReq.FilterQuery) == 0 {
// Setting this to nil to avoid ParseQuery() setting it to a match none
r.KNN[i].FilterQuery = nil
Expand Down

0 comments on commit 58c4214

Please sign in to comment.