@@ -41,6 +41,11 @@ type Options struct {
4141	// Because such indexes are lightweight, you can create thousands of such indexes without negative performance implications. 
4242	Temporary        bool 
4343	TemporaryPeriod  int 
44+ 
45+ 	// For efficiency, RediSearch encodes indexes differently if they are created with less than 32 text fields. 
46+ 	// If set to true This option forces RediSearch to encode indexes as if there were more than 32 text fields, 
47+ 	// which allows you to add additional fields (beyond 32). 
48+ 	MaxTextFieldsFlag  bool 
4449}
4550
4651func  NewOptions () * Options  {
@@ -73,15 +78,24 @@ func (options *Options) SetStopWords(stopwords []string) *Options {
7378	return  options 
7479}
7580
81+ // For efficiency, RediSearch encodes indexes differently if they are created with less than 32 text fields. 
82+ // If set to true, this flag forces RediSearch to encode indexes as if there were more than 32 text fields, 
83+ // which allows you to add additional fields (beyond 32). 
84+ func  (options  * Options ) SetMaxTextFieldsFlag (flag  bool ) * Options  {
85+ 	options .MaxTextFieldsFlag  =  flag 
86+ 	return  options 
87+ }
88+ 
7689// DefaultOptions represents the default options 
7790var  DefaultOptions  =  Options {
78- 	NoSave :          false ,
79- 	NoFieldFlags :    false ,
80- 	NoFrequencies :   false ,
81- 	NoOffsetVectors : false ,
82- 	Stopwords :       nil ,
83- 	Temporary :       false ,
84- 	TemporaryPeriod : 0 ,
91+ 	NoSave :            false ,
92+ 	NoFieldFlags :      false ,
93+ 	NoFrequencies :     false ,
94+ 	NoOffsetVectors :   false ,
95+ 	Stopwords :         nil ,
96+ 	Temporary :         false ,
97+ 	TemporaryPeriod :   0 ,
98+ 	MaxTextFieldsFlag : false ,
8599}
86100
87101const  (
@@ -242,6 +256,9 @@ func (m *Schema) AddField(f Field) *Schema {
242256
243257func  SerializeSchema (s  * Schema , args  redis.Args ) (argsOut  redis.Args , err  error ) {
244258	argsOut  =  args 
259+ 	if  s .Options .MaxTextFieldsFlag  {
260+ 		argsOut  =  append (argsOut , "MAXTEXTFIELDS" )
261+ 	}
245262	if  s .Options .NoOffsetVectors  {
246263		argsOut  =  append (argsOut , "NOOFFSETS" )
247264	}
0 commit comments