Skip to content

Commit

Permalink
关键词高亮不区分大小写
Browse files Browse the repository at this point in the history
  • Loading branch information
newpanjing committed Apr 15, 2022
1 parent c5cb60c commit dc6a3e3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions searcher/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ func (e *Engine) MultiSearch(request *model.SearchRequest) *model.SearchResult {
//处理关键词高亮
highlight := request.Highlight
if highlight != nil {
//全部小写
text = strings.ToLower(text)
for _, word := range words {
text = strings.ReplaceAll(text, word, fmt.Sprintf("%s%s%s", highlight.PreTag, word, highlight.PostTag))
}
Expand Down

0 comments on commit dc6a3e3

Please sign in to comment.