mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
improve search
This commit is contained in:
@@ -82,7 +82,6 @@ func init() {
|
||||
func SearchResource(keyword string) ([]uint, error) {
|
||||
query := bleve.NewMatchQuery(keyword)
|
||||
searchRequest := bleve.NewSearchRequest(query)
|
||||
searchRequest.Size = 1000
|
||||
searchResults, err := index.Search(searchRequest)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -90,8 +89,8 @@ func SearchResource(keyword string) ([]uint, error) {
|
||||
|
||||
results := make([]uint, 0)
|
||||
for _, hit := range searchResults.Hits {
|
||||
if hit.Score < 0.6 {
|
||||
continue
|
||||
if hit.Score < 0.2 {
|
||||
break
|
||||
}
|
||||
id, err := strconv.ParseUint(hit.ID, 10, 32)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user