package main
import (
"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")
}
-
Notifications
You must be signed in to change notification settings - Fork 6
Go use bleve with gse tokenizer
License
vcaesar/gse-bleve
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Go use bleve with gse tokenizer
Topics
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published