MCPcopy
hub / github.com/redis/redis-py / _create_hybrid_search_index

Method _create_hybrid_search_index

tests/test_search.py:4047–4076  ·  view source on GitHub ↗
(self, client, dim=4)

Source from the content-addressed store, hash-verified

4045 _HYBRID_TIMEOUT_DOCS = 1500
4046
4047 def _create_hybrid_search_index(self, client, dim=4):
4048 client.ft().create_index(
4049 (
4050 TextField("description"),
4051 NumericField("price"),
4052 TagField("color"),
4053 TagField("item_type"),
4054 NumericField("size"),
4055 VectorField(
4056 "embedding",
4057 "FLAT",
4058 {
4059 "TYPE": "FLOAT32",
4060 "DIM": dim,
4061 "DISTANCE_METRIC": "L2",
4062 },
4063 ),
4064 VectorField(
4065 "embedding-hnsw",
4066 "HNSW",
4067 {
4068 "TYPE": "FLOAT32",
4069 "DIM": dim,
4070 "DISTANCE_METRIC": "L2",
4071 },
4072 ),
4073 ),
4074 definition=IndexDefinition(prefix=["item:"]),
4075 )
4076 SearchTestsBase.waitForIndex(client, "idx")
4077
4078 def _create_hybrid_search_timeout_index(self, client):
4079 client.ft().create_index(

Calls 8

TextFieldClass · 0.90
NumericFieldClass · 0.90
TagFieldClass · 0.90
VectorFieldClass · 0.90
IndexDefinitionClass · 0.90
create_indexMethod · 0.80
ftMethod · 0.45
waitForIndexMethod · 0.45

Tested by

no test coverage detected