-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
40 lines (34 loc) · 1.03 KB
/
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
33
34
35
36
37
38
39
40
package search
import (
"context"
"gopkg.in/olivere/elastic.v6"
)
type Intent struct {
Type string `json:"type"`
Language string `json:"language"`
Value interface{} `json:"value,omitempty"`
}
type QueryResult struct {
SearchResult *elastic.SearchResult `json:"search_result,omitempty"`
// TODO: Intents field below is deprecated and not being used.
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)
}
type SearchRequestOptions struct {
resultTypes []string
docIds []string
index string
query Query
sortBy string
from int
size int
preference string
useHighlight bool
// Following field comes to solve elastic bug with highlight.
// Just removed the analyzed fields and uses only standard fields
// for highlighting. Only happens with intents.
partialHighlight bool
}