Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
ea41f88
Add schema add and MAXTEXTFIELD support
felixls Nov 28, 2019
1df27b3
Fix the problem that the parameters LANGUAGE is not supported in the …
Nov 28, 2019
5e9b094
[add] testing for the query serialize method
Dec 5, 2019
f0362cd
Merge pull request #29 from bingeng99/feature/language
filipecosta90 Dec 5, 2019
f05c46b
[add] added IF {condition} to FT.ADD API
filipecosta90 Dec 17, 2019
6df6eae
Merge pull request #33 from RediSearch/replace.partial
filipecosta90 Dec 17, 2019
b96444b
[add] support for FT.SUGLEN, FT.SUGDEL. Included default options for …
filipecosta90 Dec 17, 2019
fcc6707
[merge] merged with master
filipecosta90 Dec 17, 2019
db9fc01
[add] improved spellcheck coverage
filipecosta90 Dec 17, 2019
dd1a63a
[add] enable LOAD parameter on FT.AGGREGATE command
filipecosta90 Dec 24, 2019
14ebde9
Merge pull request #37 from RediSearch/ft.aggregate.load
filipecosta90 Dec 24, 2019
54ac477
[add] added supported commands table to Readme
filipecosta90 Jan 24, 2020
77d272d
Merge pull request #38 from RediSearch/documentation
filipecosta90 Jan 27, 2020
ff7fae8
Update client.go
gkorland Mar 4, 2020
5e0163d
move from garyburd to gomodule
gkorland Mar 4, 2020
35d3f5d
Fix build
gkorland Mar 4, 2020
9613a4f
Merge pull request #45 from RediSearch/redigo
gkorland Mar 4, 2020
2778128
fix bug aggregate and fix bug limit
Mar 30, 2020
0369d52
[add] extended tests for Paging serialize()
filipecosta90 Mar 30, 2020
5e45a0a
[add] extended coverage for document.go
filipecosta90 Mar 30, 2020
7c3434d
[add] added spellcheck test file
filipecosta90 Mar 30, 2020
6df0c36
[add] no breaking changes on autocompleter
filipecosta90 Mar 30, 2020
dc05944
[add] fixed conflicts
filipecosta90 Mar 30, 2020
e9ef654
[add] fixed merge conflicts and prunned code
filipecosta90 Mar 30, 2020
c07c79e
[add] prunning changes
filipecosta90 Mar 30, 2020
f8833ae
[add] prunning changes
filipecosta90 Mar 30, 2020
84903f5
[add] Updated Readme with new supported commands
filipecosta90 Mar 30, 2020
dc65c2d
[add] support for FT.GET and FT.MGET
filipecosta90 Mar 30, 2020
78cab8d
[fix] fixed TestClient_Get
filipecosta90 Mar 30, 2020
a198e9c
[add] add support for FT.DICTADD FT.DICTDEL and FT.DICTDUMP
filipecosta90 Mar 30, 2020
e97368c
[add] added support for FT.ALIASADD, FT.ALIASUPDATE, FT.ALIASDEL
filipecosta90 Mar 31, 2020
31029bc
[add] updated Readme with Alias supported commands
filipecosta90 Mar 31, 2020
e440655
Merge pull request #46 from mriskyp/fix_bug_redisearch
filipecosta90 Apr 1, 2020
2ad24bb
Merge branch 'master' of https://github.com/RediSearch/redisearch-go …
filipecosta90 Apr 1, 2020
5cfa76b
[add] added test for FT.AGGREGATE reply parsing. (quick refactoring i…
filipecosta90 Apr 1, 2020
b7769b1
Merge branch 'master' into ft.sug.refactor
filipecosta90 Apr 2, 2020
522e62a
Merge pull request #48 from RediSearch/extend.coverage
gkorland Apr 2, 2020
9e484b4
[add] added missing inline docs
filipecosta90 Apr 2, 2020
09c668e
Merge branch 'master' into ft.sug.refactor
filipecosta90 Apr 2, 2020
c5e3c09
[fix] fixed conflicts on test files
filipecosta90 Apr 2, 2020
f5e7755
[add] added missing inline documents for Single Document Indexing Opt…
filipecosta90 Apr 2, 2020
82d2f33
[fix] moved IndexingOptions( represent the options for indexing a sin…
filipecosta90 Apr 2, 2020
8e48e5d
Merge pull request #36 from RediSearch/ft.sug.refactor
gkorland Apr 2, 2020
9817666
Support FT.CONFIG command
dengliming Apr 4, 2020
910ef02
Merge pull request #50 from dengliming/master
filipecosta90 Apr 5, 2020
531d81d
Support FT.TAGVALS command
dengliming Apr 5, 2020
809e4da
Merge pull request #53 from dengliming/f_get_tagvals
filipecosta90 Apr 5, 2020
7ccd0b5
Update README.md (#54)
dengliming Apr 6, 2020
a595a0d
Shared pool among clients and fixed pool resources release (#51)
filipecosta90 Apr 7, 2020
76b1c66
Support FT.SYNADD FT.SYNUPDATE FT.SYNDUMP commands (#55)
dengliming Apr 10, 2020
b4cac87
Support FT.ADDHASH command (#62)
dengliming Apr 20, 2020
42408e1
NewSchema fix and extended testing for SerializeSchema (#58)
filipecosta90 Apr 21, 2020
216ad27
Support GeoField GEOFILTER FILTER (#63)
dengliming Apr 23, 2020
9e670fa
Update README.md
gkorland Apr 24, 2020
20b650b
Merge branch 'master' of https://github.com/Felixls/redisearch-go int…
filipecosta90 May 1, 2020
4ea6536
Merge branch 'Felixls-master'
filipecosta90 May 1, 2020
4a6e496
[add] updated CI rules
filipecosta90 May 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- run: go test -v ./... -race -coverprofile=coverage.txt -covermode=atomic
- run: bash <(curl -s https://codecov.io/bash) -t ${CODECOV_TOKEN}

build_nightly: # test nightly with redisearch:edge
build_nightly: # test nightly with redisearch:edge
docker:
- image: circleci/golang:1.9
- image: redislabs/redisearch:edge
Expand All @@ -40,4 +40,4 @@ workflows:
only:
- master
jobs:
- build_nightly
- build_nightly
40 changes: 38 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


# RediSearch Go Client
[![Mailing List](https://img.shields.io/badge/Mailing%20List-RediSearch-blue)](https://groups.google.com/forum/#!forum/redisearch)
[![Forum](https://img.shields.io/badge/Forum-RediSearch-blue)](https://forum.redislabs.com/c/modules/redisearch/)
[![Gitter](https://badges.gitter.im/RedisLabs/RediSearch.svg)](https://gitter.im/RedisLabs/RediSearch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Go client for [RediSearch](http://redisearch.io), based on redigo.
Expand All @@ -21,7 +21,7 @@ go get github.com/RediSearch/redisearch-go/redisearch
# Usage Example

```go

package main
import (
"fmt"
"log"
Expand Down Expand Up @@ -70,3 +70,39 @@ func ExampleClient() {
// Output: doc1 Hello world 1 <nil>
}
```


## Supported RediSearch Commands

| Command | Recommended API and godoc |
| :--- | ----: |
| [FT.CREATE](https://oss.redislabs.com/redisearch/Commands.html#ftcreate) | [CreateIndex](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.CreateIndex) |
| [FT.ADD](https://oss.redislabs.com/redisearch/Commands.html#ftadd) | [IndexOptions](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.IndexOptions) |
| [FT.ADDHASH](https://oss.redislabs.com/redisearch/Commands.html#ftaddhash) | [AddHash](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.AddHash) |
| [FT.ALTER](https://oss.redislabs.com/redisearch/Commands.html#ftalter) | [AddField](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.AddField) |
| [FT.ALIASADD](https://oss.redislabs.com/redisearch/Commands.html#ftaliasadd) | [AliasAdd](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.AliasAdd) |
| [FT.ALIASUPDATE](https://oss.redislabs.com/redisearch/Commands.html#ftaliasupdate) | [AliasUpdate](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.AliasUpdate) |
| [FT.ALIASDEL](https://oss.redislabs.com/redisearch/Commands.html#ftaliasdel) | [AliasDel](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.AliasDel) |
| [FT.INFO](https://oss.redislabs.com/redisearch/Commands.html#ftinfo) | [Info](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Info) |
| [FT.SEARCH](https://oss.redislabs.com/redisearch/Commands.html#ftsearch) | [Search](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Search) |
| [FT.AGGREGATE](https://oss.redislabs.com/redisearch/Commands.html#ftaggregate) | [Aggregate](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Aggregate) |
| [FT.CURSOR](https://oss.redislabs.com/redisearch/Aggregations.html#cursor_api) | [Aggregate](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Aggregate) + (*WithCursor option set to True) |
| [FT.EXPLAIN](https://oss.redislabs.com/redisearch/Commands.html#ftexplain) | [Explain](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Explain) |
| [FT.DEL](https://oss.redislabs.com/redisearch/Commands.html#ftdel) | [Delete](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Delete) |
| [FT.GET](https://oss.redislabs.com/redisearch/Commands.html#ftget) | [Get](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Get) |
| [FT.MGET](https://oss.redislabs.com/redisearch/Commands.html#ftmget) | [MultiGet](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Multi) |
| [FT.DROP](https://oss.redislabs.com/redisearch/Commands.html#ftdrop) | [Drop](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.Drop) |
| [FT.TAGVALS](https://oss.redislabs.com/redisearch/Commands.html#fttagvals) | [GetTagVals](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.GetTagVals) |
| [FT.SUGADD](https://oss.redislabs.com/redisearch/Commands.html#ftsugadd) | [AddTerms](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Autocompleter.AddTerms) |
| [FT.SUGGET](https://oss.redislabs.com/redisearch/Commands.html#ftsugget) | [SuggestOpts](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Autocompleter.SuggestOpts) |
| [FT.SUGDEL](https://oss.redislabs.com/redisearch/Commands.html#ftsugdel) | [DeleteTerms](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Autocompleter.DeleteTerms) |
| [FT.SUGLEN](https://oss.redislabs.com/redisearch/Commands.html#ftsuglen) | [Autocompleter.Length](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Autocompleter.Length) |
| [FT.SYNADD](https://oss.redislabs.com/redisearch/Commands.html#ftsynadd) | [SynAdd](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.SynAdd) |
| [FT.SYNUPDATE](https://oss.redislabs.com/redisearch/Commands.html#ftsynupdate) | [SynUpdate](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.SynUpdate) |
| [FT.SYNDUMP](https://oss.redislabs.com/redisearch/Commands.html#ftsyndump) | [SynDump](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.SynDump) |
| [FT.SPELLCHECK](https://oss.redislabs.com/redisearch/Commands.html#ftspellcheck) | [SpellCheck](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.SpellCheck) |
| [FT.DICTADD](https://oss.redislabs.com/redisearch/Commands.html#ftdictadd) | [DictAdd](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.DictAdd) |
| [FT.DICTDEL](https://oss.redislabs.com/redisearch/Commands.html#ftdictdel) | [DictDel](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.DictDel) |
| [FT.DICTDUMP](https://oss.redislabs.com/redisearch/Commands.html#ftdictdump) | [DictDump](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.DictDump) |
| [FT.CONFIG](https://oss.redislabs.com/redisearch/Commands.html#ftconfig) | [SetConfig](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.SetConfig)、[GetConfig](https://godoc.org/github.com/RediSearch/redisearch-go/redisearch#Client.GetConfig) |

39 changes: 35 additions & 4 deletions redisearch/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package redisearch

import (
"fmt"
"github.com/garyburd/redigo/redis"
"github.com/gomodule/redigo/redis"
"log"
"reflect"
)
Expand Down Expand Up @@ -123,9 +123,8 @@ type AggregateQuery struct {
Max int
WithSchema bool
Verbatim bool
// TODO: add cursor
WithCursor bool
Cursor *Cursor
WithCursor bool
Cursor *Cursor
// TODO: add load fields

}
Expand Down Expand Up @@ -187,6 +186,18 @@ func (a *AggregateQuery) Limit(offset int, num int) *AggregateQuery {
return a
}

//Load document fields from the document HASH objects (if they are not in the sortables)
func (a *AggregateQuery) Load(Properties []string) *AggregateQuery {
nproperties := len(Properties)
if nproperties > 0 {
a.AggregatePlan = a.AggregatePlan.Add("LOAD", nproperties)
for _, property := range Properties {
a.AggregatePlan = a.AggregatePlan.Add(fmt.Sprintf("@%s", property))
}
}
return a
}

//Adds a GROUPBY clause to the aggregate plan
func (a *AggregateQuery) GroupBy(group GroupBy) *AggregateQuery {
a.AggregatePlan = a.AggregatePlan.AddFlat(group.Serialize())
Expand Down Expand Up @@ -249,6 +260,7 @@ func (q AggregateQuery) Serialize() redis.Args {
return args
}

// Deprecated: Please use processAggReply() instead
func ProcessAggResponse(res []interface{}) [][]string {
aggregateReply := make([][]string, len(res), len(res))
for i := 0; i < len(res); i++ {
Expand All @@ -262,6 +274,25 @@ func ProcessAggResponse(res []interface{}) [][]string {
return aggregateReply
}

func processAggReply(res []interface{}) (total int, aggregateReply [][]string, err error) {
aggregateReply = [][]string{}
total = 0
aggregate_results := len(res) - 1
if aggregate_results > 0 {
total = aggregate_results
aggregateReply = make([][]string, aggregate_results, aggregate_results)
for i := 0; i < aggregate_results; i++ {
if d, e := redis.Strings(res[i+1], nil); e == nil {
aggregateReply[i] = d
} else {
err = fmt.Errorf("Error parsing Aggregate Reply: %v on reply position %d", e, i)
aggregateReply[i] = nil
}
}
}
return
}

func ProcessAggResponseSS(res []interface{}) [][]string {
var lout = len(res)
aggregateReply := make([][]string, lout, lout)
Expand Down
Loading