forked from forgejo/forgejo
Upgrade bleve to v1.0.10 (#12737)
* Fix bug on migration 111 * Upgrade bleve to 1.0.10 Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
1b9d5074a7
commit
d17efaa114
90 changed files with 12172 additions and 489 deletions
23
vendor/github.com/blevesearch/bleve/search.go
generated
vendored
23
vendor/github.com/blevesearch/bleve/search.go
generated
vendored
|
@ -18,6 +18,7 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"sort"
|
||||
"time"
|
||||
|
||||
"github.com/blevesearch/bleve/analysis"
|
||||
|
@ -264,6 +265,7 @@ func (h *HighlightRequest) AddField(field string) {
|
|||
// Score controls the kind of scoring performed
|
||||
// SearchAfter supports deep paging by providing a minimum sort key
|
||||
// SearchBefore supports deep paging by providing a maximum sort key
|
||||
// sortFunc specifies the sort implementation to use for sorting results.
|
||||
//
|
||||
// A special field named "*" can be used to return all fields.
|
||||
type SearchRequest struct {
|
||||
|
@ -279,6 +281,8 @@ type SearchRequest struct {
|
|||
Score string `json:"score,omitempty"`
|
||||
SearchAfter []string `json:"search_after"`
|
||||
SearchBefore []string `json:"search_before"`
|
||||
|
||||
sortFunc func(sort.Interface)
|
||||
}
|
||||
|
||||
func (r *SearchRequest) Validate() error {
|
||||
|
@ -606,3 +610,22 @@ func MemoryNeededForSearchResult(req *SearchRequest) uint64 {
|
|||
|
||||
return uint64(estimate)
|
||||
}
|
||||
|
||||
// SetSortFunc sets the sort implementation to use when sorting hits.
|
||||
//
|
||||
// SearchRequests can specify a custom sort implementation to meet
|
||||
// their needs. For instance, by specifying a parallel sort
|
||||
// that uses all available cores.
|
||||
func (r *SearchRequest) SetSortFunc(s func(sort.Interface)) {
|
||||
r.sortFunc = s
|
||||
}
|
||||
|
||||
// SortFunc returns the sort implementation to use when sorting hits.
|
||||
// Defaults to sort.Sort.
|
||||
func (r *SearchRequest) SortFunc() func(data sort.Interface) {
|
||||
if r.sortFunc != nil {
|
||||
return r.sortFunc
|
||||
}
|
||||
|
||||
return sort.Sort
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue