4444
4545NOOFFSETS = "NOOFFSETS"
4646NOFIELDS = "NOFIELDS"
47+ NOHL = "NOHL"
48+ NOFREQS = "NOFREQS"
49+ MAXTEXTFIELDS = "MAXTEXTFIELDS"
50+ TEMPORARY = "TEMPORARY"
4751STOPWORDS = "STOPWORDS"
52+ SKIPINITIALSCAN = "SKIPINITIALSCAN"
4853WITHSCORES = "WITHSCORES"
4954FUZZY = "FUZZY"
5055WITHPAYLOADS = "WITHPAYLOADS"
@@ -66,27 +71,57 @@ def create_index(
6671 no_field_flags = False ,
6772 stopwords = None ,
6873 definition = None ,
74+ max_text_fields = False ,
75+ temporary = None ,
76+ no_highlight = False ,
77+ no_term_frequencies = False ,
78+ skip_initial_scan = False ,
6979 ):
7080 """
7181 Create the search index. The index must not already exist.
7282
7383 ### Parameters:
7484
7585 - **fields**: a list of TextField or NumericField objects
76- - **no_term_offsets**: If true, we will not save term offsets in the index
77- - **no_field_flags**: If true, we will not save field flags that allow searching in specific fields
78- - **stopwords**: If not None, we create the index with this custom stopword list. The list can be empty
86+ - **no_term_offsets**: If true, we will not save term offsets in
87+ the index
88+ - **no_field_flags**: If true, we will not save field flags that
89+ allow searching in specific fields
90+ - **stopwords**: If not None, we create the index with this custom
91+ stopword list. The list can be empty
92+ - **max_text_fields**: If true, we will encode indexes as if there
93+ were more than 32 text fields which allows you to add additional
94+ fields (beyond 32).
95+ - **temporary**: Create a lightweight temporary index which will
96+ expire after the specified period of inactivity (in seconds). The
97+ internal idle timer is reset whenever the index is searched or added to.
98+ - **no_highlight**: If true, disabling highlighting support.
99+ Also implied by no_term_offsets.
100+ - **no_term_frequencies**: If true, we avoid saving the term frequencies
101+ in the index.
102+ - **skip_initial_scan**: If true, we do not scan and index.
79103
80104 For more information: https://oss.redis.com/redisearch/Commands/#ftcreate
81105 """ # noqa
82106
83107 args = [CREATE_CMD , self .index_name ]
84108 if definition is not None :
85109 args += definition .args
110+ if max_text_fields :
111+ args .append (MAXTEXTFIELDS )
112+ if temporary is not None and isinstance (temporary , int ):
113+ args .append (TEMPORARY )
114+ args .append (temporary )
86115 if no_term_offsets :
87116 args .append (NOOFFSETS )
117+ if no_highlight :
118+ args .append (NOHL )
88119 if no_field_flags :
89120 args .append (NOFIELDS )
121+ if no_term_frequencies :
122+ args .append (NOFREQS )
123+ if skip_initial_scan :
124+ args .append (SKIPINITIALSCAN )
90125 if stopwords is not None and isinstance (stopwords , (list , tuple , set )):
91126 args += [STOPWORDS , len (stopwords )]
92127 if len (stopwords ) > 0 :
@@ -129,7 +164,6 @@ def dropindex(self, delete_documents=False):
129164 ### Parameters:
130165
131166 - **delete_documents**: If `True`, all documents will be deleted.
132-
133167 For more information: https://oss.redis.com/redisearch/Commands/#ftdropindex
134168 """ # noqa
135169 keep_str = "" if delete_documents else "KEEPDOCS"
@@ -217,23 +251,27 @@ def add_document(
217251 ### Parameters
218252
219253 - **doc_id**: the id of the saved document.
220- - **nosave**: if set to true, we just index the document, and don't \
221- save a copy of it. This means that searches will just return ids.
222- - **score**: the document ranking, between 0.0 and 1.0.
223- - **payload**: optional inner-index payload we can save for fast access in scoring functions
224- - **replace**: if True, and the document already is in the index, \
254+ - **nosave**: if set to true, we just index the document, and don't
255+ save a copy of it. This means that searches will just
256+ return ids.
257+ - **score**: the document ranking, between 0.0 and 1.0
258+ - **payload**: optional inner-index payload we can save for fast
259+ i access in scoring functions
260+ - **replace**: if True, and the document already is in the index,
225261 we perform an update and reindex the document
226- - **partial**: if True, the fields specified will be added to the \
227- existing document. \
228- This has the added benefit that any fields specified \
229- with `no_index` will not be reindexed again. Implies `replace`
262+ - **partial**: if True, the fields specified will be added to the
263+ existing document.
264+ This has the added benefit that any fields specified
265+ with `no_index`
266+ will not be reindexed again. Implies `replace`
230267 - **language**: Specify the language used for document tokenization.
231- - **no_create**: if True, the document is only updated and reindexed \
232- if it already exists. If the document does not exist, an error will be \
233- returned. Implies `replace`
234- - **fields** kwargs dictionary of the document fields to be saved and/or indexed.
235-
236- NOTE: Geo points shoule be encoded as strings of "lon,lat"
268+ - **no_create**: if True, the document is only updated and reindexed
269+ if it already exists.
270+ If the document does not exist, an error will be
271+ returned. Implies `replace`
272+ - **fields** kwargs dictionary of the document fields to be saved
273+ and/or indexed.
274+ NOTE: Geo points shoule be encoded as strings of "lon,lat"
237275
238276 For more information: https://oss.redis.com/redisearch/Commands/#ftadd
239277 """ # noqa
@@ -481,7 +519,7 @@ def spellcheck(self, query, distance=None, include=None, exclude=None):
481519
482520 **query**: search query.
483521 **distance***: the maximal Levenshtein distance for spelling
484- suggestions (default: 1, max: 4).
522+ suggestions (default: 1, max: 4).
485523 **include**: specifies an inclusion custom dictionary.
486524 **exclude**: specifies an exclusion custom dictionary.
487525
0 commit comments