@@ -109,6 +109,7 @@ class Client(object):
109109 ALTER_CMD = 'FT.ALTER'
110110 SEARCH_CMD = 'FT.SEARCH'
111111 ADD_CMD = 'FT.ADD'
112+ ADDHASH_CMD = "FT.ADDHASH"
112113 DROP_CMD = 'FT.DROP'
113114 EXPLAIN_CMD = 'FT.EXPLAIN'
114115 DEL_CMD = 'FT.DEL'
@@ -209,7 +210,7 @@ def create_index(self, fields, no_term_offsets=False,
209210 - **stopwords**: If not None, we create the index with this custom stopword list. The list can be empty
210211 """
211212
212- args = [self .CREATE_CMD , self .index_name , 'ON' , 'HASH' ]
213+ args = [self .CREATE_CMD , self .index_name ]
213214 if no_term_offsets :
214215 args .append (self .NOOFFSETS )
215216 if no_field_flags :
@@ -275,6 +276,25 @@ def _add_document(self, doc_id, conn=None, nosave=False, score=1.0, payload=None
275276 args += list (itertools .chain (* fields .items ()))
276277 return conn .execute_command (* args )
277278
279+ def _add_document_hash (
280+ self , doc_id , conn = None , score = 1.0 , language = None , replace = False ,
281+ ):
282+ """
283+ Internal add_document_hash used for both batch and single doc indexing
284+ """
285+ if conn is None :
286+ conn = self .redis
287+
288+ args = [self .ADDHASH_CMD , self .index_name , doc_id , score ]
289+
290+ if replace :
291+ args .append ("REPLACE" )
292+
293+ if language :
294+ args += ["LANGUAGE" , language ]
295+
296+ return conn .execute_command (* args )
297+
278298 def add_document (self , doc_id , nosave = False , score = 1.0 , payload = None ,
279299 replace = False , partial = False , language = None , no_create = False , ** fields ):
280300 """
0 commit comments