diff --git a/search/document_store.go b/search/document_store.go index 9a6fb1c3518e6be0c9e8a3c1b6e5eff47b831548..76f34aa92916390abd0ce8ea738e9cfd3427c9cb 100644 --- a/search/document_store.go +++ b/search/document_store.go @@ -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, } diff --git a/search/opensearch_types.go b/search/opensearch_types.go index 7a05e67303e5eea81c09a21ed06de9f0a4a481e9..896541be6658c549b0ce4e57b22dd67f1a0cb6e0 100644 --- a/search/opensearch_types.go +++ b/search/opensearch_types.go @@ -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 }