fix SearchRequest parsing to default to proper default sort order
This commit is contained in:
parent
0bb69a9a1c
commit
be56380833
|
@ -238,6 +238,7 @@ func (r *SearchRequest) UnmarshalJSON(input []byte) error {
|
|||
Fields []string `json:"fields"`
|
||||
Facets FacetsRequest `json:"facets"`
|
||||
Explain bool `json:"explain"`
|
||||
Sort search.SortOrder `json:"sort"`
|
||||
}
|
||||
|
||||
err := json.Unmarshal(input, &temp)
|
||||
|
@ -250,6 +251,9 @@ func (r *SearchRequest) UnmarshalJSON(input []byte) error {
|
|||
} else {
|
||||
r.Size = *temp.Size
|
||||
}
|
||||
if temp.Sort == nil {
|
||||
r.Sort = search.SortOrder{&search.SortScore{Descending: true}}
|
||||
}
|
||||
r.From = temp.From
|
||||
r.Explain = temp.Explain
|
||||
r.Highlight = temp.Highlight
|
||||
|
|
Loading…
Reference in New Issue