@@ -23,6 +23,31 @@ class HybridQuery(AggregationQuery):
2323 HybridQuery combines text and vector search in Redis.
2424 It allows you to perform a hybrid search using both text and vector similarity.
2525 It scores documents based on a weighted combination of text and vector similarity.
26+
27+ .. code-block:: python
28+
29+ from redisvl.query import HybridQuery
30+ from redisvl.index import SearchIndex
31+
32+ index = SearchIndex.from_yaml("path/to/index.yaml")
33+
34+ query = HybridQuery(
35+ text="example text",
36+ text_field_name="text_field",
37+ vector=[0.1, 0.2, 0.3],
38+ vector_field_name="vector_field",
39+ text_scorer="BM25STD",
40+ filter_expression=None,
41+ alpha=0.7,
42+ dtype="float32",
43+ num_results=10,
44+ return_fields=["field1", "field2"],
45+ stopwords="english",
46+ dialect=2,
47+ )
48+
49+ results = index.query(query)
50+
2651 """
2752
2853 DISTANCE_ID : str = "vector_distance"
@@ -72,29 +97,6 @@ def __init__(
7297 ValueError: If the text string is empty, or if the text string becomes empty after
7398 stopwords are removed.
7499 TypeError: If the stopwords are not a set, list, or tuple of strings.
75-
76- .. code-block:: python
77- from redisvl.query import HybridQuery
78- from redisvl.index import SearchIndex
79-
80- index = SearchIndex.from_yaml("path/to/index.yaml")
81-
82- query = HybridQuery(
83- text="example text",
84- text_field_name="text_field",
85- vector=[0.1, 0.2, 0.3],
86- vector_field_name="vector_field",
87- text_scorer="BM25STD",
88- filter_expression=None,
89- alpha=0.7,
90- dtype="float32",
91- num_results=10,
92- return_fields=["field1", "field2"],
93- stopwords="english",
94- dialect=2,
95- )
96-
97- results = index.query(query)
98100 """
99101
100102 if not text .strip ():
0 commit comments