Check stopwords

This commit is contained in:
2025-09-10 20:06:46 +08:00
parent af81f66f25
commit 45beaced89
3 changed files with 34 additions and 0 deletions

View File

@@ -101,3 +101,14 @@ func SearchResource(keyword string) ([]uint, error) {
return results, nil
}
func IsStopWord(word string) bool {
mapping := bleve.NewIndexMapping()
analyzerName := mapping.DefaultAnalyzer
analyzer := mapping.AnalyzerNamed(analyzerName)
if analyzer == nil {
return false
}
tokens := analyzer.Analyze([]byte(word))
return len(tokens) == 0
}