-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.go
More file actions
37 lines (31 loc) · 1.04 KB
/
search.go
File metadata and controls
37 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
* hlquery - Search beyond keywords.
* https://www.hlquery.com
*
* Copyright (C) 2021-2026, Carlos F. Ferry <carlos.ferry@gmail.com>
*
* This file is part of hlquery Go API client, released under the BSD License version 3.
*/
package hlquery
import "fmt"
// Search provides search operations
type Search struct {
client *Client
}
// Perform performs a search query
func (s *Search) Perform(collection string, params map[string]interface{}) (*Response, error) {
path := fmt.Sprintf("/collections/%s/search", collection)
return s.client.request("POST", path, params)
}
// Multi performs multiple searches
func (s *Search) Multi(searches []map[string]interface{}) (*Response, error) {
body := map[string]interface{}{
"searches": searches,
}
return s.client.request("POST", "/multi_search", body)
}
// Vector performs a vector search
func (s *Search) Vector(collection string, params map[string]interface{}) (*Response, error) {
path := fmt.Sprintf("/collections/%s/vector_search", collection)
return s.client.request("POST", path, params)
}