Skip to content

Commit c905133

Browse files
Update examples/quotes/backend/quotes.py
Co-authored-by: Quentin Pradet <[email protected]>
1 parent 0debc60 commit c905133

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

examples/quotes/backend/quotes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ async def search_quotes(req: SearchRequest) -> SearchResponse:
111111
if req.query == '':
112112
s = s.query(dsl.query.MatchAll())
113113
elif req.knn:
114-
s = s.query(dsl.query.Knn(field=Quote._doc.embedding, query_vector=model.encode(req.query).tolist()))
114+
query_vector = model.encode(req.query).tolist()
115+
s = s.query(dsl.query.Knn(field=Quote._doc.embedding, query_vector=query_vector))
115116
else:
116117
s = s.query(dsl.query.Match(quote=req.query))
117118
for tag in req.filters:

0 commit comments

Comments
 (0)