https://github.com/ttys3/blugejieba
GoJieba Bluge support
https://github.com/ttys3/blugejieba
bleve blevesearch bluge index search
Last synced: 3 months ago
JSON representation
GoJieba Bluge support
- Host: GitHub
- URL: https://github.com/ttys3/blugejieba
- Owner: ttys3
- Created: 2023-01-03T11:40:07.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-30T11:14:39.000Z (almost 2 years ago)
- Last Synced: 2025-01-17T15:42:37.810Z (5 months ago)
- Topics: bleve, blevesearch, bluge, index, search
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GoJieba Bluge support
[](https://godoc.org/github.com/ttys3/blugejieba)
[](https://goreportcard.com/report/ttys3/blugejieba)## Intro
GoJieba [Bluge](https://github.com/blugelabs/bluge) support mod
Bluge is an indexing library for Go. created by the author of the [Bleve](https://github.com/blevesearch/bleve) project
## Get the mod
```bash
go get github.com/ttys3/blugejieba
```## Usage
```go
// var ana bluge.Analyzer
jieba := &analysis.Analyzer{
Tokenizer: NewJiebaTokenizer(gojieba.DICT_PATH, gojieba.HMM_PATH, gojieba.USER_DICT_PATH, gojieba.IDF_PATH, gojieba.STOP_WORDS_PATH),
}
// for write
doc := bluge.NewDocument(msg.Id).
AddField(bluge.NewTextField("name", "hello bluge").WithAnalyzer(jieba))
err = writer.Update(doc.ID(), doc)
// for read (query)
query := bluge.NewMatchQuery(q).SetField("name").SetAnalyzer(jieba)
request := bluge.NewTopNSearch(10, query).
WithStandardAggregations()
documentMatchIterator, err := reader.Search(context.Background(), request)
if err != nil {
log.Fatalf("error executing search: %v", err)
}
```please see [jieba_tokenizer_test.go](jieba_tokenizer_test.go)
## docs
https://blugelabs.com/bluge/migration/
https://blugelabs.com/blog/introducing-bluge/
## related project
https://github.com/ttys3/gojieba-bleve