Skip to content

Commit

Permalink
Merge #207
Browse files Browse the repository at this point in the history
207: Add test case for filter query containing space. r=alallema a=PaulKovalov

Add test case to `TestIndex_SearchWithFilters` test checking that filter query containing spaces works.

Closes #205 

Co-authored-by: paul <soapmactavish799@gmail.com>
  • Loading branch information
bors[bot] and PaulKovalov authored Oct 7, 2021
2 parents 240e0e3 + f8c4b77 commit 4dc2cc3
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions index_search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,31 @@ func TestIndex_SearchWithFilters(t *testing.T) {
ExhaustiveNbHits: false,
},
},
{
name: "TestIndexSearchWithFilterContainingSpaces",
args: args{
UID: "indexUID",
client: defaultClient,
query: "and",
filterableAttributes: []string{
"tag",
},
request: SearchRequest{
Filter: "tag = 'Crime fiction'",
},
},
want: &SearchResponse{
Hits: []interface{}{
map[string]interface{}{
"book_id": float64(1032), "title": "Crime and Punishment",
},
},
NbHits: 1,
Offset: 0,
Limit: 20,
ExhaustiveNbHits: false,
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down Expand Up @@ -661,15 +686,14 @@ func TestIndex_SearchWithFilters(t *testing.T) {
}
}


func TestIndex_SearchWithSort(t *testing.T) {
type args struct {
UID string
PrimaryKey string
client *Client
query string
sortableAttributes []string
request SearchRequest
UID string
PrimaryKey string
client *Client
query string
sortableAttributes []string
request SearchRequest
}
tests := []struct {
name string
Expand Down

0 comments on commit 4dc2cc3

Please sign in to comment.