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

Method test_alter_schema_add

tests/test_search.py:883–904  ·  view source on GitHub ↗
(self, client)

Source from the content-addressed store, hash-verified

881
882 @pytest.mark.redismod
883 def test_alter_schema_add(self, client):
884 # Creating the index definition and schema
885 client.ft().create_index(TextField("title"))
886
887 # Using alter to add a field
888 client.ft().alter_schema_add(TextField("body"))
889
890 # Indexing a document
891 client.hset(
892 "doc1",
893 mapping={"title": "MyTitle", "body": "Some content only in the body"},
894 )
895
896 # Searching with parameter only in the body (the added field)
897 q = Query("only in the body")
898
899 # Ensure we find the result searching on the added body field
900 res = client.ft().search(q)
901 if expects_resp2_shape(client) or expects_unified_shape(client):
902 assert 1 == res.total
903 elif expects_resp3_shape(client):
904 assert 1 == res["total_results"]
905
906 @pytest.mark.redismod
907 def test_spell_check(self, client):

Callers

nothing calls this directly

Calls 10

TextFieldClass · 0.90
QueryClass · 0.90
expects_resp2_shapeFunction · 0.85
expects_unified_shapeFunction · 0.85
expects_resp3_shapeFunction · 0.85
create_indexMethod · 0.80
alter_schema_addMethod · 0.80
hsetMethod · 0.80
ftMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected