mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-24 10:00:50 +00:00
enh(search): improve issue search
- new sort by relevency option for issue search - rework bleve fuzzy search to consider each term rather than matching the entire phrase
This commit is contained in:
parent
c8ba330833
commit
a265574821
10 changed files with 56 additions and 31 deletions
|
@ -19,6 +19,15 @@ func NumericEqualityQuery(value int64, field string) *query.NumericRangeQuery {
|
|||
return q
|
||||
}
|
||||
|
||||
// MatchQuery generates a match query for the given phrase, field and analyzer
|
||||
func MatchQuery(matchTerm, field, analyzer string, fuzziness int) *query.MatchQuery {
|
||||
q := bleve.NewMatchQuery(matchTerm)
|
||||
q.FieldVal = field
|
||||
q.Analyzer = analyzer
|
||||
q.Fuzziness = fuzziness
|
||||
return q
|
||||
}
|
||||
|
||||
// MatchPhraseQuery generates a match phrase query for the given phrase, field and analyzer
|
||||
func MatchPhraseQuery(matchPhrase, field, analyzer string, fuzziness int) *query.MatchPhraseQuery {
|
||||
q := bleve.NewMatchPhraseQuery(matchPhrase)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue