Skip to content

Commit cecd915

Browse files
Update for redisvl 0.11.0
1 parent e87175e commit cecd915

File tree

8 files changed

+2478
-81
lines changed

8 files changed

+2478
-81
lines changed

content/develop/ai/redisvl/api/_index.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ Reference documentation for the RedisVL API.
1515
* [Schema](schema/)
1616
* [IndexSchema](schema/#indexschema)
1717
* [Defining Fields](schema/#defining-fields)
18-
* [Supported Field Types and Attributes](schema/#supported-field-types-and-attributes)
18+
* [Basic Field Types](schema/#basic-field-types)
19+
* [Vector Field Types](schema/#vector-field-types)
20+
* [SVS-VAMANA Configuration Utilities](schema/#svs-vamana-configuration-utilities)
21+
* [Vector Algorithm Comparison](schema/#vector-algorithm-comparison)
1922
* [Search Index Classes](searchindex/)
2023
* [SearchIndex](searchindex/#searchindex)
2124
* [AsyncSearchIndex](searchindex/#asyncsearchindex)

content/develop/ai/redisvl/api/query.md

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -730,39 +730,18 @@ Return self as the query object.
730730

731731
## HybridQuery
732732

733-
### `class HybridQuery(text, text_field_name, vector, vector_field_name, text_scorer='BM25STD', filter_expression=None, alpha=0.7, dtype='float32', num_results=10, return_fields=None, stopwords='english', dialect=2)`
733+
### `class HybridQuery(*args, **kwargs)`
734734

735-
Bases: `AggregationQuery`
736-
737-
HybridQuery combines text and vector search in Redis.
738-
It allows you to perform a hybrid search using both text and vector similarity.
739-
It scores documents based on a weighted combination of text and vector similarity.
740-
741-
```python
742-
from redisvl.query import HybridQuery
743-
from redisvl.index import SearchIndex
735+
Bases: `AggregateHybridQuery`
744736

745-
index = SearchIndex.from_yaml("path/to/index.yaml")
737+
Backward compatibility wrapper for AggregateHybridQuery.
746738

747-
query = HybridQuery(
748-
text="example text",
749-
text_field_name="text_field",
750-
vector=[0.1, 0.2, 0.3],
751-
vector_field_name="vector_field",
752-
text_scorer="BM25STD",
753-
filter_expression=None,
754-
alpha=0.7,
755-
dtype="float32",
756-
num_results=10,
757-
return_fields=["field1", "field2"],
758-
stopwords="english",
759-
dialect=2,
760-
)
761-
762-
results = index.query(query)
763-
```
739+
#### `Deprecated`
740+
Deprecated since version HybridQuery: is a backward compatibility wrapper around AggregateHybridQuery
741+
and will eventually be replaced with a new hybrid query implementation.
742+
To maintain current functionality please use AggregateHybridQuery directly.",
764743

765-
Instantiates a HybridQuery object.
744+
Instantiates a AggregateHybridQuery object.
766745

767746
* **Parameters:**
768747
* **text** (*str*) – The text to search for.
@@ -785,6 +764,9 @@ Instantiates a HybridQuery object.
785764
set, or tuple of strings is provided then those will be used as stopwords.
786765
Defaults to "english". if set to "None" then no stopwords will be removed.
787766
* **dialect** (*int* *,* *optional*) – The Redis dialect version. Defaults to 2.
767+
* **text_weights** (*Optional* *[* *Dict* *[* *str* *,* *float* *]* *]*) – The importance weighting of individual words
768+
within the query text. Defaults to None, as no modifications will be made to the
769+
text_scorer score.
788770
* **Raises:**
789771
* **ValueError** – If the text string is empty, or if the text string becomes empty after
790772
stopwords are removed.
@@ -922,6 +904,14 @@ Default is TFIDF.
922904
* **Return type:**
923905
*AggregateRequest*
924906

907+
#### `set_text_weights(weights)`
908+
909+
Set or update the text weights for the query.
910+
911+
* **Parameters:**
912+
* **text_weights** – Dictionary of word:weight mappings
913+
* **weights** (*Dict* *[* *str* *,* *float* *]*)
914+
925915
#### `sort_by(*fields, **kwargs)`
926916

927917
Indicate how the results should be sorted. This can also be used for
@@ -975,9 +965,18 @@ Return the stopwords used in the query.
975965
:returns: The stopwords used in the query.
976966
:rtype: Set[str]
977967

968+
#### `property text_weights: Dict[str, float]`
969+
970+
Get the text weights.
971+
972+
* **Returns:**
973+
weight mappings.
974+
* **Return type:**
975+
Dictionary of word
976+
978977
## TextQuery
979978

980-
### `class TextQuery(text, text_field_name, text_scorer='BM25STD', filter_expression=None, return_fields=None, num_results=10, return_score=True, dialect=2, sort_by=None, in_order=False, params=None, stopwords='english')`
979+
### `class TextQuery(text, text_field_name, text_scorer='BM25STD', filter_expression=None, return_fields=None, num_results=10, return_score=True, dialect=2, sort_by=None, in_order=False, params=None, stopwords='english', text_weights=None)`
981980

982981
Bases: `BaseQuery`
983982

@@ -1038,6 +1037,9 @@ A query for running a full text search, along with an optional filter expression
10381037
a default set of stopwords for that language will be used. Users may specify
10391038
their own stop words by providing a List or Set of words. if set to None,
10401039
then no words will be removed. Defaults to ‘english’.
1040+
* **text_weights** (*Optional* *[* *Dict* *[* *str* *,* *float* *]* *]*) – The importance weighting of individual words
1041+
within the query text. Defaults to None, as no modifications will be made to the
1042+
text_scorer score.
10411043
* **Raises:**
10421044
* **ValueError** – if stopwords language string cannot be loaded.
10431045
* **TypeError** – If stopwords is not a valid iterable set of strings.
@@ -1184,6 +1186,14 @@ Set the filter expression for the query.
11841186
* **Raises:**
11851187
**TypeError** – If filter_expression is not a valid FilterExpression or string.
11861188

1189+
#### `set_text_weights(weights)`
1190+
1191+
Set or update the text weights for the query.
1192+
1193+
* **Parameters:**
1194+
* **text_weights** – Dictionary of word:weight mappings
1195+
* **weights** (*Dict* *[* *str* *,* *float* *]*)
1196+
11871197
#### `slop(slop)`
11881198

11891199
Allow a maximum of N intervening non matched terms between
@@ -1289,6 +1299,15 @@ Get the text field name(s) - for backward compatibility.
12891299
Either a single field name string (if only one field with weight 1.0)
12901300
or a dictionary of field:weight mappings.
12911301

1302+
#### `property text_weights: Dict[str, float]`
1303+
1304+
Get the text weights.
1305+
1306+
* **Returns:**
1307+
weight mappings.
1308+
* **Return type:**
1309+
Dictionary of word
1310+
12921311
## FilterQuery
12931312

12941313
### `class FilterQuery(filter_expression=None, return_fields=None, num_results=10, dialect=2, sort_by=None, in_order=False, params=None)`
@@ -1797,7 +1816,7 @@ Return self as the query object.
17971816

17981817
Bases: `AggregationQuery`
17991818

1800-
MultiVectorQuery allows for search over multiple vector fields in a document simulateously.
1819+
MultiVectorQuery allows for search over multiple vector fields in a document simultaneously.
18011820
The final score will be a weighted combination of the individual vector similarity scores
18021821
following the formula:
18031822

0 commit comments

Comments
 (0)