-
Notifications
You must be signed in to change notification settings - Fork 0
/
queryresult.go
63 lines (55 loc) · 1.77 KB
/
queryresult.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package govespa
type QueryResponse struct {
Root Root `json:"root"`
}
type Root struct {
Id string `json:"id,omitempty"`
Relevance float64 `json:"relevance"`
Label string `json:"label,omitempty"`
Source string `json:"source,omitempty"`
Value string `json:"value,omitempty"`
Types []string `json:"types,omitempty"`
Children []children `json:"children"`
Fields fields `json:"fields"`
Coverage coverage `json:"coverage"`
Limits limits `json:"limits"`
Errors []vespaError `json:"errors,omitempty"`
}
type children struct {
Id string `json:"id,omitempty"`
Relevance float64 `json:"relevance"`
Label string `json:"label,omitempty"`
Source string `json:"source,omitempty"`
Fields map[string]any `json:"fields"`
}
func getFieldsFromChildren(ch []children) []map[string]any {
fields := make([]map[string]any, len(ch))
for i, c := range ch {
fields[i] = c.Fields
}
return fields
}
type coverage struct {
Coverage int8 `json:"coverage"`
Documents int64 `json:"documents"`
Full bool `json:"bool"`
Nodes int `json:"nodes"`
Results int `json:"results"`
ResultsFull int `json:"resultsFull"`
Degraded degraded `json:"degraded"`
}
type degraded struct {
MatchPhase bool `json:"match-phase"`
Timeout bool `json:"timeout"`
AdaptiveTimeout bool `json:"adaptive-timeout"`
NonIdealState bool `json:"non-ideal-state"`
}
type fields struct {
Summaryfeatures string `json:"summaryfeatures,omitempty"`
Matchfeatures string `json:"matchfeatures,omitempty"`
TotalCount int `json:"totalCount"`
}
type limits struct {
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
}