https://github.com/vcaesar/gse-bleve
Go use bleve with gse tokenizer
https://github.com/vcaesar/gse-bleve
bleve go gse search token
Last synced: about 1 month ago
JSON representation
Go use bleve with gse tokenizer
- Host: GitHub
- URL: https://github.com/vcaesar/gse-bleve
- Owner: vcaesar
- License: bsd-2-clause
- Created: 2021-10-03T14:34:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-30T20:03:44.000Z (over 1 year ago)
- Last Synced: 2025-03-18T11:39:15.021Z (about 1 month ago)
- Topics: bleve, go, gse, search, token
- Language: Go
- Homepage:
- Size: 82 KB
- Stars: 29
- Watchers: 3
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# gse-bleve
[](https://github.com/vcaesar/gse-bleve/commits/master)
[](https://travis-ci.org/vcaesar/gse-bleve)
[](https://circleci.com/gh/vcaesar/gse-bleve)
[](https://codecov.io/gh/vcaesar/gse-bleve)
[](https://goreportcard.com/report/github.com/vcaesar/gse-bleve)
[](https://godoc.org/github.com/vcaesar/gse-bleve)
[](https://github.com/vcaesar/gse-bleve/releases/latest)## Use
```go
package mainimport (
"fmt"
"os""github.com/blevesearch/bleve/v2"
gse "github.com/vcaesar/gse-bleve"
)func main() {
opt := gse.Option{
Index: "test.blv",
Dicts: "embed, ja",
// Dicts: "embed, zh",
Stop: "",
Opt: "search-hmm",
Trim: "trim",
}index, err := gse.New(opt)
if err != nil {
fmt.Println("new mapping error is: ", err)
return
}text := `見解では、謙虚なヴォードヴィリアンのベテランは、運命の犠牲者と悪役の両方の変遷として代償を払っています`
err = index.Index("1", text)
index.Index("3", text+"浮き沈み")
index.Index("4", `In view, a humble vaudevillian veteran cast vicariously as both victim and villain vicissitudes of fate.`)
index.Index("2", `It's difficult to understand the sum of a person's life.`)
if err != nil {
fmt.Println("index error: ", err)
}query := "運命の犠牲者"
req := bleve.NewSearchRequest(bleve.NewQueryStringQuery(query))
req.Highlight = bleve.NewHighlight()
res, err := index.Search(req)
fmt.Println(res, err)os.RemoveAll("test.blv")
}
```