@@ -126,12 +126,10 @@ func (i *Client) Search(q *Query) (docs []Document, total int, err error) {
126
126
payloadIdx = skip
127
127
skip ++
128
128
}
129
-
130
129
if q .Flags & QueryNoContent == 0 {
131
130
fieldsIdx = skip
132
131
skip ++
133
132
}
134
-
135
133
if len (res ) > skip {
136
134
for i := 1 ; i < len (res ); i += skip {
137
135
@@ -145,7 +143,8 @@ func (i *Client) Search(q *Query) (docs []Document, total int, err error) {
145
143
return
146
144
}
147
145
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.
149
148
func (i * Client ) AliasAdd (name string ) (err error ) {
150
149
conn := i .pool .Get ()
151
150
defer conn .Close ()
@@ -154,7 +153,7 @@ func (i *Client) AliasAdd(name string) (err error) {
154
153
return
155
154
}
156
155
157
- // Deletes an alias to an index.
156
+ // AliasDel deletes an alias from index.
158
157
func (i * Client ) AliasDel (name string ) (err error ) {
159
158
conn := i .pool .Get ()
160
159
defer conn .Close ()
@@ -163,7 +162,9 @@ func (i *Client) AliasDel(name string) (err error) {
163
162
return
164
163
}
165
164
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.
167
168
func (i * Client ) AliasUpdate (name string ) (err error ) {
168
169
conn := i .pool .Get ()
169
170
defer conn .Close ()
@@ -172,7 +173,7 @@ func (i *Client) AliasUpdate(name string) (err error) {
172
173
return
173
174
}
174
175
175
- // Adds terms to a dictionary.
176
+ // DictAdd adds terms to a dictionary.
176
177
func (i * Client ) DictAdd (dictionaryName string , terms []string ) (newTerms int , err error ) {
177
178
conn := i .pool .Get ()
178
179
defer conn .Close ()
@@ -182,7 +183,7 @@ func (i *Client) DictAdd(dictionaryName string, terms []string) (newTerms int, e
182
183
return
183
184
}
184
185
185
- // Deletes terms from a dictionary
186
+ // DictDel deletes terms from a dictionary
186
187
func (i * Client ) DictDel (dictionaryName string , terms []string ) (deletedTerms int , err error ) {
187
188
conn := i .pool .Get ()
188
189
defer conn .Close ()
@@ -192,7 +193,7 @@ func (i *Client) DictDel(dictionaryName string, terms []string) (deletedTerms in
192
193
return
193
194
}
194
195
195
- // Dumps all terms in the given dictionary.
196
+ // DictDump dumps all terms in the given dictionary.
196
197
func (i * Client ) DictDump (dictionaryName string ) (terms []string , err error ) {
197
198
conn := i .pool .Get ()
198
199
defer conn .Close ()
@@ -336,14 +337,12 @@ func (i *Client) MultiGet(documentIds []string) (docs []*Document, err error) {
336
337
} else {
337
338
docs [i ] = nil
338
339
}
339
-
340
340
}
341
-
342
341
}
343
342
return
344
343
}
345
344
346
- // Explain Return a textual string explaining the query
345
+ // Explain Return a textual string explaining the query (execution plan)
347
346
func (i * Client ) Explain (q * Query ) (string , error ) {
348
347
conn := i .pool .Get ()
349
348
defer conn .Close ()
@@ -354,22 +353,21 @@ func (i *Client) Explain(q *Query) (string, error) {
354
353
return redis .String (conn .Do ("FT.EXPLAIN" , args ... ))
355
354
}
356
355
357
- // Deletes the index and all the keys associated with it.
356
+ // Drop deletes the index and all the keys associated with it.
358
357
func (i * Client ) Drop () error {
359
358
conn := i .pool .Get ()
360
359
defer conn .Close ()
361
360
362
361
_ , err := conn .Do ("FT.DROP" , i .name )
363
362
return err
364
-
365
363
}
366
364
367
365
// Deletes the secondary index and optionally the associated hashes
368
366
//
369
367
// Available since RediSearch 2.0.
370
368
//
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.
373
371
func (i * Client ) DropIndex (deleteDocuments bool ) error {
374
372
conn := i .pool .Get ()
375
373
defer conn .Close ()
@@ -389,7 +387,7 @@ func (i *Client) Delete(docId string, deleteDocument bool) (err error) {
389
387
return i .delDoc (docId , deleteDocument )
390
388
}
391
389
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
393
391
func (i * Client ) DeleteDocument (docId string ) (err error ) {
394
392
return i .delDoc (docId , true )
395
393
}
@@ -406,6 +404,7 @@ func (i *Client) delDoc(docId string, deleteDocument bool) (err error) {
406
404
return
407
405
}
408
406
407
+ // Internal method to be used by Info()
409
408
func (info * IndexInfo ) setTarget (key string , value interface {}) error {
410
409
v := reflect .ValueOf (info ).Elem ()
411
410
for i := 0 ; i < v .NumField (); i ++ {
@@ -602,8 +601,8 @@ func (i *Client) GetTagVals(index string, filedName string) ([]string, error) {
602
601
return redis .Strings (conn .Do ("FT.TAGVALS" , args ... ))
603
602
}
604
603
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
607
606
func (i * Client ) SynAdd (indexName string , terms []string ) (int64 , error ) {
608
607
conn := i .pool .Get ()
609
608
defer conn .Close ()
@@ -612,7 +611,7 @@ func (i *Client) SynAdd(indexName string, terms []string) (int64, error) {
612
611
return redis .Int64 (conn .Do ("FT.SYNADD" , args ... ))
613
612
}
614
613
615
- // Updates a synonym group, with additional terms.
614
+ // SynUpdate updates a synonym group, with additional terms.
616
615
func (i * Client ) SynUpdate (indexName string , synonymGroupId int64 , terms []string ) (string , error ) {
617
616
conn := i .pool .Get ()
618
617
defer conn .Close ()
@@ -621,7 +620,7 @@ func (i *Client) SynUpdate(indexName string, synonymGroupId int64, terms []strin
621
620
return redis .String (conn .Do ("FT.SYNUPDATE" , args ... ))
622
621
}
623
622
624
- // Dumps the contents of a synonym group.
623
+ // SynDump dumps the contents of a synonym group.
625
624
func (i * Client ) SynDump (indexName string ) (map [string ][]int64 , error ) {
626
625
conn := i .pool .Get ()
627
626
defer conn .Close ()
@@ -650,7 +649,7 @@ func (i *Client) SynDump(indexName string) (map[string][]int64, error) {
650
649
}
651
650
652
651
// 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
654
653
// See the example ExampleClient_CreateIndexWithIndexDefinition for a deeper understanding on how to move towards using hashes on your application
655
654
func (i * Client ) AddHash (docId string , score float32 , language string , replace bool ) (string , error ) {
656
655
conn := i .pool .Get ()
0 commit comments