mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-26 23:35:51 +03:00
s/fields/terms (#1031)
use terms instead of fields as variable name to avoid confusion: NewPhraseQuery(terms []string, field string)
This commit is contained in:
parent
d077fd084a
commit
490d3771f7
1 changed files with 3 additions and 3 deletions
|
@ -46,12 +46,12 @@ func numericQuery(value int64, field string) *query.NumericRangeQuery {
|
||||||
// SearchIssuesByKeyword searches for issues by given conditions.
|
// SearchIssuesByKeyword searches for issues by given conditions.
|
||||||
// Returns the matching issue IDs
|
// Returns the matching issue IDs
|
||||||
func SearchIssuesByKeyword(repoID int64, keyword string) ([]int64, error) {
|
func SearchIssuesByKeyword(repoID int64, keyword string) ([]int64, error) {
|
||||||
fields := strings.Fields(strings.ToLower(keyword))
|
terms := strings.Fields(strings.ToLower(keyword))
|
||||||
indexerQuery := bleve.NewConjunctionQuery(
|
indexerQuery := bleve.NewConjunctionQuery(
|
||||||
numericQuery(repoID, "RepoID"),
|
numericQuery(repoID, "RepoID"),
|
||||||
bleve.NewDisjunctionQuery(
|
bleve.NewDisjunctionQuery(
|
||||||
bleve.NewPhraseQuery(fields, "Title"),
|
bleve.NewPhraseQuery(terms, "Title"),
|
||||||
bleve.NewPhraseQuery(fields, "Content"),
|
bleve.NewPhraseQuery(terms, "Content"),
|
||||||
))
|
))
|
||||||
search := bleve.NewSearchRequestOptions(indexerQuery, 2147483647, 0, false)
|
search := bleve.NewSearchRequestOptions(indexerQuery, 2147483647, 0, false)
|
||||||
search.Fields = []string{"ID"}
|
search.Fields = []string{"ID"}
|
||||||
|
|
Loading…
Reference in a new issue