-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
32 lines (26 loc) · 979 Bytes
/
models.go
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
package search
import (
"context"
"gopkg.in/olivere/elastic.v5"
)
type Intent struct {
Type string `json:"type"`
Language string `json:"language"`
Value interface{} `json:"value,omitempty"`
}
type Query struct {
Term string `json:"term,omitempty"`
ExactTerms []string `json:"exact_terms,omitempty"`
Filters map[string][]string `json:"filters,omitempty"`
LanguageOrder []string `json:"language_order,omitempty"`
Deb bool `json:"deb,omitempty"`
Intents []Intent `json:"intents,omitempty"`
}
type QueryResult struct {
SearchResult *elastic.SearchResult `json:"search_result,omitempty"`
Intents []Intent `json:"intents,omitempty"`
}
type Engine interface {
GetSuggestions(ctx context.Context, query Query) (interface{}, error)
DoSearch(ctx context.Context, query Query, from int, size int, preference string) (interface{}, error)
}