Skip to content

Commit 9c5fb4b

Browse files
committed
Remove deprecated HybridQuery class
1 parent 3b6ef3a commit 9c5fb4b

File tree

4 files changed

+4
-101
lines changed

4 files changed

+4
-101
lines changed

redisvl/query/aggregate.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -242,26 +242,6 @@ def __str__(self) -> str:
242242
return " ".join([str(x) for x in self.build_args()])
243243

244244

245-
class HybridQuery(AggregateHybridQuery):
246-
"""Backward compatibility wrapper for AggregateHybridQuery.
247-
248-
.. deprecated::
249-
This class is deprecated and will be removed in a future version.
250-
Please use the new HybridQuery from redisvl.query.hybrid instead.
251-
For maintaining current AggregateHybridQuery functionality, use AggregateHybridQuery directly.
252-
"""
253-
254-
def __init__(self, *args, **kwargs):
255-
warnings.warn(
256-
"This HybridQuery class is deprecated and will be removed in a future version. "
257-
"Please use the new HybridQuery from redisvl.query.hybrid instead. "
258-
"For maintaining current AggregateHybridQuery functionality, use AggregateHybridQuery directly.",
259-
DeprecationWarning,
260-
stacklevel=2,
261-
)
262-
super().__init__(*args, **kwargs)
263-
264-
265245
class MultiVectorQuery(AggregationQuery):
266246
"""
267247
MultiVectorQuery allows for search over multiple vector fields in a document simultaneously.

redisvl/query/hybrid.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
VectorSearchMethods,
1919
)
2020
except ImportError:
21-
raise ImportError("Hybrid queries require redis>=7.1.0")
21+
raise ImportError(
22+
"Hybrid queries require Redis Open Source >= 8.4.0 and redis-py>=7.1.0"
23+
)
2224

2325
from redisvl.query.filter import FilterExpression
2426

tests/integration/test_aggregation.py

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from redisvl.index import SearchIndex
44
from redisvl.query import AggregateHybridQuery, MultiVectorQuery, Vector
5-
from redisvl.query.aggregate import HybridQuery
65
from redisvl.query.filter import Geo, GeoRadius, Num, Tag, Text
76
from redisvl.redis.utils import array_to_buffer
87
from tests.conftest import skip_if_redis_version_below
@@ -744,44 +743,3 @@ def test_multivector_query_mixed_index(index):
744743
assert (
745744
float(r["combined_score"]) - score <= 0.0001
746745
) # allow for small floating point error
747-
748-
749-
def test_hybrid_query_backward_compatibility(index):
750-
skip_if_redis_version_below(index.client, "7.2.0")
751-
752-
text = "a medical professional with expertise in lung cancer"
753-
text_field = "description"
754-
vector = [0.1, 0.1, 0.5]
755-
vector_field = "user_embedding"
756-
return_fields = ["user", "credit_score", "age", "job", "location", "description"]
757-
758-
hybrid_query = AggregateHybridQuery(
759-
text=text,
760-
text_field_name=text_field,
761-
vector=vector,
762-
vector_field_name=vector_field,
763-
return_fields=return_fields,
764-
)
765-
766-
results = index.query(hybrid_query)
767-
assert len(results) == 7
768-
for result in results:
769-
assert result["user"] in [
770-
"john",
771-
"derrick",
772-
"nancy",
773-
"tyler",
774-
"tim",
775-
"taimur",
776-
"joe",
777-
"mary",
778-
]
779-
780-
with pytest.warns(DeprecationWarning):
781-
_ = HybridQuery(
782-
text=text,
783-
text_field_name=text_field,
784-
vector=vector,
785-
vector_field_name=vector_field,
786-
return_fields=return_fields,
787-
)

tests/unit/test_aggregation_types.py

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@
44
import pytest
55
from redis.commands.search.aggregation import AggregateRequest
66

7-
from redisvl.query.aggregate import (
8-
AggregateHybridQuery,
9-
HybridQuery,
10-
MultiVectorQuery,
11-
Vector,
12-
)
7+
from redisvl.query.aggregate import AggregateHybridQuery, MultiVectorQuery, Vector
138
from redisvl.query.filter import Tag
149
from redisvl.redis.utils import array_to_buffer
1510

@@ -432,35 +427,3 @@ def test_vector_object_handles_byte_conversion():
432427
byte_string = array_to_buffer(sample_vector, datatype)
433428
vec = Vector(vector=byte_string, field_name="field 1")
434429
assert vec.vector == byte_string
435-
436-
437-
def test_hybrid_query_backward_compatibility():
438-
# test that HybridQuery is a backward compatibility wrapper for AggregateHybridQuery
439-
with pytest.warns(DeprecationWarning):
440-
hybrid_query = HybridQuery(
441-
text="sample text query",
442-
text_field_name="description",
443-
vector=sample_vector,
444-
vector_field_name="embedding",
445-
)
446-
447-
# Verify HybridQuery is actually an instance of AggregateHybridQuery
448-
assert isinstance(hybrid_query, AggregateHybridQuery)
449-
450-
# Verify AggregateHybridQuery does not emit warnings
451-
with assert_no_warnings():
452-
aggregate_query = AggregateHybridQuery(
453-
text="sample text query",
454-
text_field_name="description",
455-
vector=sample_vector,
456-
vector_field_name="embedding",
457-
)
458-
459-
# Verify that creating another HybridQuery also warns
460-
with pytest.warns(DeprecationWarning):
461-
another_hybrid_query = HybridQuery(
462-
text="sample text query",
463-
text_field_name="description",
464-
vector=sample_vector,
465-
vector_field_name="embedding",
466-
)

0 commit comments

Comments
 (0)