Skip to content

Commit

Permalink
s/fields/terms (go-gitea#1031)
Browse files Browse the repository at this point in the history
use terms instead of fields as variable name to avoid confusion: NewPhraseQuery(terms []string, field string)
  • Loading branch information
bit authored and lunny committed Feb 24, 2017
1 parent d077fd0 commit 490d377
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions models/issue_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ func numericQuery(value int64, field string) *query.NumericRangeQuery {
// SearchIssuesByKeyword searches for issues by given conditions.
// Returns the matching issue IDs
func SearchIssuesByKeyword(repoID int64, keyword string) ([]int64, error) {
fields := strings.Fields(strings.ToLower(keyword))
terms := strings.Fields(strings.ToLower(keyword))
indexerQuery := bleve.NewConjunctionQuery(
numericQuery(repoID, "RepoID"),
bleve.NewDisjunctionQuery(
bleve.NewPhraseQuery(fields, "Title"),
bleve.NewPhraseQuery(fields, "Content"),
bleve.NewPhraseQuery(terms, "Title"),
bleve.NewPhraseQuery(terms, "Content"),
))
search := bleve.NewSearchRequestOptions(indexerQuery, 2147483647, 0, false)
search.Fields = []string{"ID"}
Expand Down

0 comments on commit 490d377

Please sign in to comment.