Skip to content

Commit

Permalink
[fix] Reverted long,lat position on query.go
Browse files Browse the repository at this point in the history
  • Loading branch information
filipecosta90 committed Apr 22, 2021
1 parent 9eb4376 commit 47edad4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
!/tests/*.bz2
!Makefile
!**/*.yml

# IDEs
.idea
.vscode
2 changes: 1 addition & 1 deletion redisearch/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (q Query) serialize() redis.Args {
args = appendNumArgs(opts.Max, opts.ExclusiveMax, args)
case GeoFilterOptions:
opts, _ := f.Options.(GeoFilterOptions)
args = append(args, "GEOFILTER", f.Field, opts.Lat, opts.Lon, opts.Radius, opts.Unit)
args = append(args, "GEOFILTER", f.Field, opts.Lon, opts.Lat, opts.Radius, opts.Unit)
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions redisearch/redisearch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,15 @@ func TestFilter(t *testing.T) {

// Searching with GeoFilter
docs, total, err = c.Search(NewQuery("hello world").
AddFilter(Filter{Field: "location", Options: GeoFilterOptions{Lon: 37, Lat: 15, Radius: 200, Unit: KILOMETERS}}).
AddFilter(Filter{Field: "location", Options: GeoFilterOptions{Lon: 15, Lat: 37, Radius: 200, Unit: KILOMETERS}}).
SetSortBy("age", true).
SetReturnFields("age"))
assert.Nil(t, err)
assert.Equal(t, 1, total)
assert.Equal(t, "18", docs[0].Properties["age"])

docs, total, err = c.Search(NewQuery("hello world").
AddFilter(Filter{Field: "location", Options: GeoFilterOptions{Lon: 13, Lat: 10, Radius: 1, Unit: KILOMETERS}}).
AddFilter(Filter{Field: "location", Options: GeoFilterOptions{Lon: 10, Lat: 13, Radius: 1, Unit: KILOMETERS}}).
SetSortBy("age", true).
SetReturnFields("body"))
assert.Nil(t, err)
Expand Down

0 comments on commit 47edad4

Please sign in to comment.