some bug fixes
This commit is contained in:
parent
5649acf6a8
commit
577cf4d482
10 changed files with 83 additions and 17 deletions
|
|
@ -5,6 +5,7 @@ package index
|
|||
import (
|
||||
"errors"
|
||||
"git.giftfish.de/ston1th/docstore/pkg/core"
|
||||
"github.com/bcampbell/qs"
|
||||
"github.com/blevesearch/bleve"
|
||||
"github.com/blevesearch/bleve/document"
|
||||
"github.com/blevesearch/bleve/mapping"
|
||||
|
|
@ -107,7 +108,11 @@ func (i *Index) Delete(id string) error {
|
|||
}
|
||||
|
||||
func (i *Index) Search(search string) (results core.Results, err error) {
|
||||
req := bleve.NewSearchRequest(bleve.NewQueryStringQuery(search))
|
||||
q, err := qs.Parse(search)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
req := bleve.NewSearchRequest(q)
|
||||
req.Highlight = bleve.NewHighlightWithStyle("html")
|
||||
req.Size = maxSearchResult
|
||||
res, err := i.i.Search(req)
|
||||
|
|
@ -129,7 +134,7 @@ func (i *Index) Search(search string) (results core.Results, err error) {
|
|||
for _, f := range frags {
|
||||
t += f
|
||||
}
|
||||
r.Tags = strings.ReplaceAll(strings.ReplaceAll(t, "<mark>", ""), "</mark>", "")
|
||||
r.Tags = append(r.Tags, strings.ReplaceAll(strings.ReplaceAll(t, "<mark>", ""), "</mark>", ""))
|
||||
}
|
||||
if fragField == textField || fragField == createdField {
|
||||
for _, f := range frags {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue