Skip to content

Commit

Permalink
Add retrieveVectors and fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
curquiza committed Jun 20, 2024
1 parent 12d4678 commit e795f60
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
3 changes: 3 additions & 0 deletions index_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ func searchPostRequestParams(query string, request *SearchRequest) map[string]in
hybrid["semanticRatio"] = request.Hybrid.SemanticRatio
params["hybrid"] = hybrid
}
if request.RetrieveVectors {
params["retrieveVectors"] = request.RetrieveVectors
}

return params
}
5 changes: 2 additions & 3 deletions index_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1638,11 +1638,11 @@ func TestIndex_SearchWithVectorStore(t *testing.T) {
client: defaultClient,
query: "Pride and Prejudice",
request: SearchRequest{
Vector: []float32{0.1, 0.2, 0.3},
Hybrid: &SearchRequestHybrid{
SemanticRatio: 0.5,
Embedder: "default",
},
RetrieveVectors: true,
},
}

Expand All @@ -1663,7 +1663,6 @@ func TestIndex_SearchWithVectorStore(t *testing.T) {
vectors := hit["_vectors"].(map[string]interface{})

require.NotNil(t, vectors["default"])
def := vectors["default"].([]interface{})
require.Equal(t, 3, len(def))
def := vectors["default"].(map[string]interface{})

Check failure on line 1666 in index_search_test.go

View workflow job for this annotation

GitHub Actions / linter

def declared but not used (typecheck)

Check failure on line 1666 in index_search_test.go

View workflow job for this annotation

GitHub Actions / integration-tests (go current version)

def declared but not used

Check failure on line 1666 in index_search_test.go

View workflow job for this annotation

GitHub Actions / integration-tests (go latest version)

def declared but not used

Check failure on line 1666 in index_search_test.go

View workflow job for this annotation

GitHub Actions / integration-tests-against-rc (go current version)

def declared but not used

Check failure on line 1666 in index_search_test.go

View workflow job for this annotation

GitHub Actions / integration-tests-against-rc (go latest version)

def declared but not used
}
}
1 change: 1 addition & 0 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ type SearchRequest struct {
IndexUID string
Query string
Hybrid *SearchRequestHybrid
RetrieveVectors bool
}

type SearchRequestHybrid struct {
Expand Down
7 changes: 7 additions & 0 deletions types_easyjson.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e795f60

Please sign in to comment.