Skip to content
Snippets Groups Projects
Commit 1518cf7c authored by Francé Wilke's avatar Francé Wilke
Browse files

Add limit and sorting to opensearch document store

parent fc39c396
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,7 @@ func (ds *DocumentStore) Write(id string, data interface{}) error {
// Search
// Return:
// docs will be a slice of the DocumentStore data type
func (ds *DocumentStore) Search(query Query, limit int64) (res *SearchResponseHits, err error) {
func (ds *DocumentStore) Search(query Query, sort []map[string]string, limit int64, offset int64) (res *SearchResponseHits, err error) {
if ds == nil {
return nil, errors.Errorf("document store == nil")
}
......@@ -162,7 +162,9 @@ func (ds *DocumentStore) Search(query Query, limit int64) (res *SearchResponseHi
// }
// }
body := SearchRequestBody{
Sort: sort,
Size: limit,
From: offset,
Query: query,
Timeout: Timeout,
}
......
......@@ -46,7 +46,9 @@ type Query struct {
}
type QueryBool struct {
Must []FilterQuery `json:"must,omitempty"` // List of things that must appear in matching documents and will contribute to the score.
Filter []FilterQuery `json:"filter,omitempty"` // List of things that must appear in matching documents. However, unlike must the score of the query will be ignored. Filter clauses are executed in filter context, meaning that scoring is ignored and clauses are considered for caching
Should []Query `json:"should,omitempty"` // List of things that should appear in the matching document.
MustNot []FilterQuery `json:"must_not,omitempty"` // List of things that must not appear in the matching documents. Clauses are executed in filter context meaning that scoring is ignored and clauses are considered for caching. Because scoring is ignored, a score of 0 for all documents is returned
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment