2020except (ImportError , ModuleNotFoundError ):
2121 REDIS_HYBRID_AVAILABLE = False
2222 SKIP_REASON = "Requires redis>=8.4.0 and redis-py>=7.1.0"
23- HybridQuery = None # type: ignore
23+ # HybridQuery = None # type: ignore
2424
2525
2626@pytest .fixture
@@ -139,7 +139,7 @@ def test_hybrid_query(index):
139139 return_fields = return_fields ,
140140 )
141141
142- results = index .hybrid_search (hybrid_query )
142+ results = index .query (hybrid_query )
143143 assert isinstance (results , list )
144144 assert len (results ) == 10 # Server-side default for hybrid search
145145 for doc in results :
@@ -167,7 +167,7 @@ def test_hybrid_query(index):
167167 yield_combined_score_as = "hybrid_score" ,
168168 )
169169
170- results = index .hybrid_search (hybrid_query )
170+ results = index .query (hybrid_query )
171171 assert len (results ) == 3
172172 assert (
173173 results [0 ]["hybrid_score" ]
@@ -192,12 +192,11 @@ def test_hybrid_query_with_filter(index):
192192 text_field_name = text_field ,
193193 vector = vector ,
194194 vector_field_name = vector_field ,
195- text_filter_expression = filter_expression ,
196- vector_filter_expression = filter_expression ,
195+ filter_expression = filter_expression ,
197196 return_fields = return_fields ,
198197 )
199198
200- results = index .hybrid_search (hybrid_query )
199+ results = index .query (hybrid_query )
201200 assert len (results ) == 2
202201 for result in results :
203202 assert result ["credit_score" ] == "high"
@@ -220,12 +219,11 @@ def test_hybrid_query_with_geo_filter(index):
220219 text_field_name = text_field ,
221220 vector = vector ,
222221 vector_field_name = vector_field ,
223- text_filter_expression = filter_expression ,
224- vector_filter_expression = filter_expression ,
222+ filter_expression = filter_expression ,
225223 return_fields = return_fields ,
226224 )
227225
228- results = index .hybrid_search (hybrid_query )
226+ results = index .query (hybrid_query )
229227 assert len (results ) == 3
230228 for result in results :
231229 assert result ["location" ] is not None
@@ -253,7 +251,7 @@ def test_hybrid_query_alpha(index, alpha):
253251 yield_combined_score_as = "hybrid_score" ,
254252 )
255253
256- results = index .hybrid_search (hybrid_query )
254+ results = index .query (hybrid_query )
257255 assert len (results ) == 7
258256 for result in results :
259257 score = alpha * float (result ["text_score" ]) + (1 - alpha ) * float (
@@ -291,7 +289,7 @@ def test_hybrid_query_stopwords(index):
291289 assert "medical" not in query_string
292290 assert "expertise" not in query_string
293291
294- results = index .hybrid_search (hybrid_query )
292+ results = index .query (hybrid_query )
295293 assert len (results ) == 7
296294 for result in results :
297295 score = alpha * float (result ["text_score" ]) + (1 - alpha ) * float (
@@ -318,14 +316,13 @@ def test_hybrid_query_with_text_filter(index):
318316 text_field_name = text_field ,
319317 vector = vector ,
320318 vector_field_name = vector_field ,
321- text_filter_expression = filter_expression ,
322- vector_filter_expression = filter_expression ,
319+ filter_expression = filter_expression ,
323320 combination_method = "LINEAR" ,
324321 yield_combined_score_as = "hybrid_score" ,
325322 return_fields = [text_field ],
326323 )
327324
328- results = index .hybrid_search (hybrid_query )
325+ results = index .query (hybrid_query )
329326 assert len (results ) == 2
330327 for result in results :
331328 assert "medical" in result [text_field ].lower ()
@@ -338,14 +335,13 @@ def test_hybrid_query_with_text_filter(index):
338335 text_field_name = text_field ,
339336 vector = vector ,
340337 vector_field_name = vector_field ,
341- text_filter_expression = filter_expression ,
342- vector_filter_expression = filter_expression ,
338+ filter_expression = filter_expression ,
343339 combination_method = "LINEAR" ,
344340 yield_combined_score_as = "hybrid_score" ,
345341 return_fields = [text_field ],
346342 )
347343
348- results = index .hybrid_search (hybrid_query )
344+ results = index .query (hybrid_query )
349345 assert len (results ) == 2
350346 for result in results :
351347 assert "medical" in result [text_field ].lower ()
@@ -377,7 +373,7 @@ def test_hybrid_query_word_weights(index, scorer):
377373 yield_text_score_as = "text_score" ,
378374 )
379375
380- weighted_results = index .hybrid_search (weighted_query )
376+ weighted_results = index .query (weighted_query )
381377 assert len (weighted_results ) == 7
382378
383379 # test that weights do change the scores on results
@@ -392,7 +388,7 @@ def test_hybrid_query_word_weights(index, scorer):
392388 yield_text_score_as = "text_score" ,
393389 )
394390
395- unweighted_results = index .hybrid_search (unweighted_query )
391+ unweighted_results = index .query (unweighted_query )
396392
397393 for weighted , unweighted in zip (weighted_results , unweighted_results ):
398394 for word in weights :
@@ -412,7 +408,7 @@ def test_hybrid_query_word_weights(index, scorer):
412408 yield_text_score_as = "text_score" ,
413409 )
414410
415- weighted_results = index .hybrid_search (weighted_query )
411+ weighted_results = index .query (weighted_query )
416412 assert weighted_results != unweighted_results
417413
418414
@@ -439,7 +435,7 @@ async def test_hybrid_query_async(async_index):
439435 return_fields = return_fields ,
440436 )
441437
442- results = await async_index .hybrid_search (hybrid_query )
438+ results = await async_index .query (hybrid_query )
443439 assert isinstance (results , list )
444440 assert len (results ) == 7
445441 for doc in results :
@@ -467,7 +463,7 @@ async def test_hybrid_query_async(async_index):
467463 yield_combined_score_as = "hybrid_score" ,
468464 )
469465
470- results = await async_index .hybrid_search (hybrid_query )
466+ results = await async_index .query (hybrid_query )
471467 assert len (results ) == 3
472468 assert (
473469 results [0 ]["hybrid_score" ]
@@ -494,7 +490,7 @@ def test_hybrid_search_not_available_in_server(index):
494490 )
495491
496492 with pytest .raises (ResponseError , match = r"unknown command .FT\.HYBRID" ):
497- index .hybrid_search (hybrid_query )
493+ index .query (hybrid_query )
498494
499495
500496@pytest .mark .skipif (
@@ -510,4 +506,4 @@ def test_hybrid_query_not_available():
510506)
511507def test_hybrid_search_method_missing (index ):
512508 with pytest .raises (NotImplementedError ):
513- index .hybrid_search (None )
509+ index .query (None )
0 commit comments