Skip to content

Commit f28463d

Browse files
fixes typo on query string weight assignment
1 parent 299566d commit f28463d

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

redisvl/query/aggregate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def _tokenize_and_escape_query(self, user_query: str) -> str:
238238
]
239239
for i, token in enumerate(token_list):
240240
if token in self._text_weights:
241-
token_list[i] = f"{token}=>{{weight:{self._text_weights[token]}}}"
241+
token_list[i] = f"{token}=>{{$weight:{self._text_weights[token]}}}"
242242

243243
if not token_list:
244244
raise ValueError("text string cannot be empty after removing stopwords")

redisvl/query/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ def _tokenize_and_escape_query(self, user_query: str) -> str:
11601160
]
11611161
for i, token in enumerate(token_list):
11621162
if token in self._text_weights:
1163-
token_list[i] = f"{token}=>{{weight:{self._text_weights[token]}}}"
1163+
token_list[i] = f"{token}=>{{$weight:{self._text_weights[token]}}}"
11641164

11651165
return " | ".join(token_list)
11661166

tests/unit/test_aggregation_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def test_hybrid_query_text_weights():
211211

212212
assert (
213213
str(query)
214-
== "(~@description:(query | string | alpha=>{weight:2} | bravo | delta=>{weight:0.555} | tango | alpha=>{weight:2}))=>[KNN 10 @user_embedding $vector AS vector_distance] SCORER BM25STD ADDSCORES DIALECT 2 APPLY (2 - @vector_distance)/2 AS vector_similarity APPLY @__score AS text_score APPLY 0.30000000000000004*@text_score + 0.7*@vector_similarity AS hybrid_score SORTBY 2 @hybrid_score DESC MAX 10"
214+
== "(~@description:(query | string | alpha=>{$weight:2} | bravo | delta=>{$weight:0.555} | tango | alpha=>{$weight:2}))=>[KNN 10 @user_embedding $vector AS vector_distance] SCORER BM25STD ADDSCORES DIALECT 2 APPLY (2 - @vector_distance)/2 AS vector_similarity APPLY @__score AS text_score APPLY 0.30000000000000004*@text_score + 0.7*@vector_similarity AS hybrid_score SORTBY 2 @hybrid_score DESC MAX 10"
215215
)
216216

217217
# raise an error if weights are not positive floats

tests/unit/test_query_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ def test_text_query_word_weights():
343343

344344
assert (
345345
str(query)
346-
== "@description:(query | string | alpha=>{weight:2} | bravo | delta=>{weight:0.555} | tango | alpha=>{weight:2}) SCORER BM25STD WITHSCORES DIALECT 2 LIMIT 0 10"
346+
== "@description:(query | string | alpha=>{$weight:2} | bravo | delta=>{$weight:0.555} | tango | alpha=>{$weight:2}) SCORER BM25STD WITHSCORES DIALECT 2 LIMIT 0 10"
347347
)
348348

349349
# raise an error if weights are not positive floats

0 commit comments

Comments
 (0)