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

Method alter_schema_add

redis/commands/search/commands.py:973–991  ·  view source on GitHub ↗

Alter the existing search index by adding new fields. The index must already exist. ### Parameters: - **fields**: a list of Field objects to add for the index For more information see `FT.ALTER <https://redis.io/commands/ft.alter>`_.

(self, fields: Union[Field, List[Field]])

Source from the content-addressed store, hash-verified

971 return self.execute_command(*args)
972
973 def alter_schema_add(self, fields: Union[Field, List[Field]]):
974 """
975 Alter the existing search index by adding new fields. The index
976 must already exist.
977
978 ### Parameters:
979
980 - **fields**: a list of Field objects to add for the index
981
982 For more information see `FT.ALTER <https://redis.io/commands/ft.alter>`_.
983 """ # noqa
984
985 args = [ALTER_CMD, self.index_name, "SCHEMA", "ADD"]
986 try:
987 args += list(itertools.chain(*(f.redis_args() for f in fields)))
988 except TypeError:
989 args += fields.redis_args()
990
991 return self.execute_command(*args)
992
993 def dropindex(self, delete_documents: bool = False):
994 """

Callers 3

test_alter_schema_addMethod · 0.80
test_max_text_fieldsMethod · 0.80
test_alter_schema_addMethod · 0.80

Calls 2

redis_argsMethod · 0.80
execute_commandMethod · 0.45

Tested by 3

test_alter_schema_addMethod · 0.64
test_max_text_fieldsMethod · 0.64
test_alter_schema_addMethod · 0.64