@@ -126,12 +126,10 @@ func (i *Client) Search(q *Query) (docs []Document, total int, err error) {
126126 payloadIdx = skip
127127 skip ++
128128 }
129-
130129 if q .Flags & QueryNoContent == 0 {
131130 fieldsIdx = skip
132131 skip ++
133132 }
134-
135133 if len (res ) > skip {
136134 for i := 1 ; i < len (res ); i += skip {
137135
@@ -145,7 +143,8 @@ func (i *Client) Search(q *Query) (docs []Document, total int, err error) {
145143 return
146144}
147145
148- // Adds an alias to an index.
146+ // AliasAdd adds an alias to an index.
147+ // Indexes can have more than one alias, though an alias cannot refer to another alias.
149148func (i * Client ) AliasAdd (name string ) (err error ) {
150149 conn := i .pool .Get ()
151150 defer conn .Close ()
@@ -154,7 +153,7 @@ func (i *Client) AliasAdd(name string) (err error) {
154153 return
155154}
156155
157- // Deletes an alias to an index.
156+ // AliasDel deletes an alias from index.
158157func (i * Client ) AliasDel (name string ) (err error ) {
159158 conn := i .pool .Get ()
160159 defer conn .Close ()
@@ -163,7 +162,9 @@ func (i *Client) AliasDel(name string) (err error) {
163162 return
164163}
165164
166- // Deletes an alias to an index.
165+ // AliasUpdate differs from the AliasAdd in that it will remove the alias association with
166+ // a previous index, if any. AliasAdd will fail, on the other hand, if the alias is already
167+ // associated with another index.
167168func (i * Client ) AliasUpdate (name string ) (err error ) {
168169 conn := i .pool .Get ()
169170 defer conn .Close ()
@@ -172,7 +173,7 @@ func (i *Client) AliasUpdate(name string) (err error) {
172173 return
173174}
174175
175- // Adds terms to a dictionary.
176+ // DictAdd adds terms to a dictionary.
176177func (i * Client ) DictAdd (dictionaryName string , terms []string ) (newTerms int , err error ) {
177178 conn := i .pool .Get ()
178179 defer conn .Close ()
@@ -182,7 +183,7 @@ func (i *Client) DictAdd(dictionaryName string, terms []string) (newTerms int, e
182183 return
183184}
184185
185- // Deletes terms from a dictionary
186+ // DictDel deletes terms from a dictionary
186187func (i * Client ) DictDel (dictionaryName string , terms []string ) (deletedTerms int , err error ) {
187188 conn := i .pool .Get ()
188189 defer conn .Close ()
@@ -192,7 +193,7 @@ func (i *Client) DictDel(dictionaryName string, terms []string) (deletedTerms in
192193 return
193194}
194195
195- // Dumps all terms in the given dictionary.
196+ // DictDump dumps all terms in the given dictionary.
196197func (i * Client ) DictDump (dictionaryName string ) (terms []string , err error ) {
197198 conn := i .pool .Get ()
198199 defer conn .Close ()
@@ -336,14 +337,12 @@ func (i *Client) MultiGet(documentIds []string) (docs []*Document, err error) {
336337 } else {
337338 docs [i ] = nil
338339 }
339-
340340 }
341-
342341 }
343342 return
344343}
345344
346- // Explain Return a textual string explaining the query
345+ // Explain Return a textual string explaining the query (execution plan)
347346func (i * Client ) Explain (q * Query ) (string , error ) {
348347 conn := i .pool .Get ()
349348 defer conn .Close ()
@@ -354,22 +353,21 @@ func (i *Client) Explain(q *Query) (string, error) {
354353 return redis .String (conn .Do ("FT.EXPLAIN" , args ... ))
355354}
356355
357- // Deletes the index and all the keys associated with it.
356+ // Drop deletes the index and all the keys associated with it.
358357func (i * Client ) Drop () error {
359358 conn := i .pool .Get ()
360359 defer conn .Close ()
361360
362361 _ , err := conn .Do ("FT.DROP" , i .name )
363362 return err
364-
365363}
366364
367365// Deletes the secondary index and optionally the associated hashes
368366//
369367// Available since RediSearch 2.0.
370368//
371- // By default, DropIndex() which is a wrapper for RediSearch FT.DROPINDEX does not delete the document hashes associated with the index.
372- // Setting the argument deleteDocuments to true deletes the hashes as well.
369+ // By default, DropIndex() which is a wrapper for RediSearch FT.DROPINDEX does not delete the document
370+ // hashes associated with the index. Setting the argument deleteDocuments to true deletes the hashes as well.
373371func (i * Client ) DropIndex (deleteDocuments bool ) error {
374372 conn := i .pool .Get ()
375373 defer conn .Close ()
@@ -389,7 +387,7 @@ func (i *Client) Delete(docId string, deleteDocument bool) (err error) {
389387 return i .delDoc (docId , deleteDocument )
390388}
391389
392- // Delete the document from the index and also delete the HASH key in which the document is stored
390+ // DeleteDocument delete the document from the index and also delete the HASH key in which the document is stored
393391func (i * Client ) DeleteDocument (docId string ) (err error ) {
394392 return i .delDoc (docId , true )
395393}
@@ -406,6 +404,7 @@ func (i *Client) delDoc(docId string, deleteDocument bool) (err error) {
406404 return
407405}
408406
407+ // Internal method to be used by Info()
409408func (info * IndexInfo ) setTarget (key string , value interface {}) error {
410409 v := reflect .ValueOf (info ).Elem ()
411410 for i := 0 ; i < v .NumField (); i ++ {
@@ -602,8 +601,8 @@ func (i *Client) GetTagVals(index string, filedName string) ([]string, error) {
602601 return redis .Strings (conn .Do ("FT.TAGVALS" , args ... ))
603602}
604603
605- // Adds a synonym group.
606- // Deprecated: This function is not longer supported on RediSearch 2.0 and above, use SynUpdate instead
604+ // SynAdd adds a synonym group.
605+ // Deprecated: This function is not longer supported on RediSearch 2.0 and above, use SynUpdate instead
607606func (i * Client ) SynAdd (indexName string , terms []string ) (int64 , error ) {
608607 conn := i .pool .Get ()
609608 defer conn .Close ()
@@ -612,7 +611,7 @@ func (i *Client) SynAdd(indexName string, terms []string) (int64, error) {
612611 return redis .Int64 (conn .Do ("FT.SYNADD" , args ... ))
613612}
614613
615- // Updates a synonym group, with additional terms.
614+ // SynUpdate updates a synonym group, with additional terms.
616615func (i * Client ) SynUpdate (indexName string , synonymGroupId int64 , terms []string ) (string , error ) {
617616 conn := i .pool .Get ()
618617 defer conn .Close ()
@@ -621,7 +620,7 @@ func (i *Client) SynUpdate(indexName string, synonymGroupId int64, terms []strin
621620 return redis .String (conn .Do ("FT.SYNUPDATE" , args ... ))
622621}
623622
624- // Dumps the contents of a synonym group.
623+ // SynDump dumps the contents of a synonym group.
625624func (i * Client ) SynDump (indexName string ) (map [string ][]int64 , error ) {
626625 conn := i .pool .Get ()
627626 defer conn .Close ()
@@ -650,7 +649,7 @@ func (i *Client) SynDump(indexName string) (map[string][]int64, error) {
650649}
651650
652651// Adds a document to the index from an existing HASH key in Redis.
653- // Deprecated: This function is not longer supported on RediSearch 2.0 and above, use HSET instead
652+ // Deprecated: This function is not longer supported on RediSearch 2.0 and above, use HSET instead
654653// See the example ExampleClient_CreateIndexWithIndexDefinition for a deeper understanding on how to move towards using hashes on your application
655654func (i * Client ) AddHash (docId string , score float32 , language string , replace bool ) (string , error ) {
656655 conn := i .pool .Get ()
0 commit comments