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

Method dropindex

redis/commands/search/commands.py:993–1016  ·  view source on GitHub ↗

Drop the index if it exists. Replaced `drop_index` in RediSearch 2.0. Default behavior was changed to not delete the indexed documents. ### Parameters: - **delete_documents**: If `True`, all documents will be deleted. For more information see `FT.D

(self, delete_documents: bool = False)

Source from the content-addressed store, hash-verified

991 return self.execute_command(*args)
992
993 def dropindex(self, delete_documents: bool = False):
994 """
995 Drop the index if it exists.
996 Replaced `drop_index` in RediSearch 2.0.
997 Default behavior was changed to not delete the indexed documents.
998
999 ### Parameters:
1000
1001 - **delete_documents**: If `True`, all documents will be deleted.
1002
1003 For more information see `FT.DROPINDEX <https://redis.io/commands/ft.dropindex>`_.
1004 """ # noqa
1005 args = [DROPINDEX_CMD, self.index_name]
1006
1007 delete_str = (
1008 "DD"
1009 if isinstance(delete_documents, bool) and delete_documents is True
1010 else ""
1011 )
1012
1013 if delete_str:
1014 args.append(delete_str)
1015
1016 return self.execute_command(*args)
1017
1018 def _add_document(
1019 self,

Callers

nothing calls this directly

Calls 2

appendMethod · 0.45
execute_commandMethod · 0.45

Tested by 12

createIndexMethod · 0.64
test_drop_indexMethod · 0.64
test_max_text_fieldsMethod · 0.64
test_casesensitiveMethod · 0.64
test_withsuffixtrieMethod · 0.64
createIndexMethod · 0.64
test_drop_indexMethod · 0.64
test_withsuffixtrieMethod · 0.64