├── .github ├── CONTRIBUTING.md ├── issue_template.md ├── pull_request_template.md └── workflows │ └── go.yml ├── .gitignore ├── LICENSE ├── README.md ├── analyzer.go ├── bleve.go ├── bleve_test.go ├── circle.yml ├── examples └── main.go ├── go.mod ├── go.sum └── index.go /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to gse-bleve 2 | 3 | -------------------------------------------------------------------------------- /.github/issue_template.md: -------------------------------------------------------------------------------- 1 | 1. Please **speak English (English only)**, this is the language everybody of us can speak and write. 2 | 2. Please ask questions or config/deploy problems on our Gitter channel: https://gitter.im/go-ego/ego 3 | 3. Please take a moment to search that an issue **doesn't already exist**. 4 | 4. Please give all relevant information below for bug reports, incomplete details will be handled as an invalid report. 5 | 6 | **You MUST delete the content above including this line before posting, otherwise your issue will be invalid.** 7 | 8 | - gse-bleve version (or commit ref): 9 | - Go version: 10 | 11 | - Operating system and bit: 12 | - Can you reproduce the bug at [Examples](https://github.com/vcaesar/gse-bleve/tree/master/examples): 13 | - [ ] Yes (provide example code) 14 | - [ ] No 15 | - [ ] Not relevant 16 | - Provide example code: 17 | ```Go 18 | 19 | ``` 20 | - Log gist: 21 | 22 | ## Description 23 | 24 | ... 25 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | The pull request will be closed without any reasons if it does not satisfy any of following requirements: 2 | 3 | 1. Make sure you are targeting the `master` branch, pull requests on release branches are only allowed for bug fixes. 4 | 2. Please read contributing guidelines: [CONTRIBUTING](https://github.com/vcaesar/gse-bleve/blob/master/CONTRIBUTING.md) 5 | 3. Describe what your pull request does and which issue you're targeting (if any and Please use English) 6 | 4. ... if it is not related to any particular issues, explain why we should not reject your pull request. 7 | 5. The Commits must **use English**, must be test and No useless submissions. 8 | 9 | **You MUST delete the content above including this line before posting, otherwise your pull request will be invalid.** 10 | 11 | **Please provide Issues links to:** 12 | 13 | - Issues: #1 14 | 15 | **Provide test code:** 16 | 17 | ```Go 18 | 19 | ``` 20 | 21 | ## Description 22 | 23 | ... 24 | -------------------------------------------------------------------------------- /.github/workflows/go.yml: -------------------------------------------------------------------------------- 1 | name: Go 2 | on: [push] 3 | jobs: 4 | test: 5 | # name: build 6 | strategy: 7 | matrix: 8 | # go: [1.16.x, 1.17.x] 9 | os: [macOS-latest, windows-latest, ubuntu-latest] 10 | runs-on: ${{ matrix.os }} 11 | 12 | steps: 13 | - name: Set up Go 1.21.0 14 | uses: actions/setup-go@v1 15 | with: 16 | go-version: 1.21.0 17 | id: go 18 | 19 | - name: Check out code into the Go module directory 20 | uses: actions/checkout@v1 21 | 22 | - name: Get dependencies 23 | run: | 24 | go get -v -t -d ./... 25 | 26 | - name: Build 27 | run: go build -v . 28 | - name: Test 29 | run: go test -v . 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Object files 2 | .DS_Store 3 | .vscode 4 | .idea 5 | 6 | examples/examples 7 | examples/test.blv 8 | test.blv 9 | 10 | # Binaries for programs and plugins 11 | *.exe 12 | *.exe~ 13 | *.dll 14 | *.so 15 | *.dylib 16 | 17 | # Test binary, built with `go test -c` 18 | *.test 19 | 20 | # Output of the go coverage tool, specifically when used with LiteIDE 21 | *.out 22 | 23 | # Dependency directories (remove the comment below to include it) 24 | # vendor/ 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2021, Evans 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gse-bleve 2 | 3 | [![Build Status](https://github.com/vcaesar/gse-bleve/workflows/Go/badge.svg)](https://github.com/vcaesar/gse-bleve/commits/master) 4 | [![Build Status](https://travis-ci.org/vcaesar/gse-bleve.svg)](https://travis-ci.org/vcaesar/gse-bleve) 5 | [![CircleCI Status](https://circleci.com/gh/vcaesar/gse-bleve.svg?style=shield)](https://circleci.com/gh/vcaesar/gse-bleve) 6 | [![codecov](https://codecov.io/gh/vcaesar/gse-bleve/branch/master/graph/badge.svg)](https://codecov.io/gh/vcaesar/gse-bleve) 7 | [![Go Report Card](https://goreportcard.com/badge/github.com/vcaesar/gse-bleve)](https://goreportcard.com/report/github.com/vcaesar/gse-bleve) 8 | [![GoDoc](https://godoc.org/github.com/vcaesar/gse-bleve?status.svg)](https://godoc.org/github.com/vcaesar/gse-bleve) 9 | [![Release](https://github-release-version.herokuapp.com/github/vcaesar/gse-bleve/release.svg?style=flat)](https://github.com/vcaesar/gse-bleve/releases/latest) 10 | 11 | 12 | ## Use 13 | 14 | ```go 15 | package main 16 | 17 | import ( 18 | "fmt" 19 | "os" 20 | 21 | "github.com/blevesearch/bleve/v2" 22 | gse "github.com/vcaesar/gse-bleve" 23 | ) 24 | 25 | func main() { 26 | opt := gse.Option{ 27 | Index: "test.blv", 28 | Dicts: "embed, ja", 29 | // Dicts: "embed, zh", 30 | Stop: "", 31 | Opt: "search-hmm", 32 | Trim: "trim", 33 | } 34 | 35 | index, err := gse.New(opt) 36 | if err != nil { 37 | fmt.Println("new mapping error is: ", err) 38 | return 39 | } 40 | 41 | text := `見解では、謙虚なヴォードヴィリアンのベテランは、運命の犠牲者と悪役の両方の変遷として代償を払っています` 42 | err = index.Index("1", text) 43 | index.Index("3", text+"浮き沈み") 44 | index.Index("4", `In view, a humble vaudevillian veteran cast vicariously as both victim and villain vicissitudes of fate.`) 45 | index.Index("2", `It's difficult to understand the sum of a person's life.`) 46 | if err != nil { 47 | fmt.Println("index error: ", err) 48 | } 49 | 50 | query := "運命の犠牲者" 51 | req := bleve.NewSearchRequest(bleve.NewQueryStringQuery(query)) 52 | req.Highlight = bleve.NewHighlight() 53 | res, err := index.Search(req) 54 | fmt.Println(res, err) 55 | 56 | os.RemoveAll("test.blv") 57 | } 58 | ``` -------------------------------------------------------------------------------- /analyzer.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Evans. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gsebleve 6 | 7 | import ( 8 | "errors" 9 | 10 | "github.com/blevesearch/bleve/v2/analysis" 11 | "github.com/blevesearch/bleve/v2/registry" 12 | ) 13 | 14 | func NewAnalyzer(config map[string]interface{}, cache *registry.Cache) (analysis.Analyzer, error) { 15 | tokenizerName, ok := config["tokenizer"].(string) 16 | if !ok { 17 | return nil, errors.New("must have tokenizer") 18 | } 19 | 20 | tokenizer, err := cache.TokenizerNamed(tokenizerName) 21 | if err != nil { 22 | return nil, err 23 | } 24 | 25 | az := &analysis.DefaultAnalyzer{Tokenizer: tokenizer} 26 | return az, nil 27 | } 28 | 29 | func init() { 30 | registry.RegisterAnalyzer(TokenName, NewAnalyzer) 31 | registry.RegisterAnalyzer(SeparateName, NewAnalyzer) 32 | } 33 | -------------------------------------------------------------------------------- /bleve.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Evans. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gsebleve 6 | 7 | import ( 8 | "strings" 9 | 10 | "github.com/blevesearch/bleve/v2/analysis" 11 | "github.com/blevesearch/bleve/v2/registry" 12 | "github.com/go-ego/gse" 13 | ) 14 | 15 | const ( 16 | TokenName = "gse" 17 | SeparateName = "sep" 18 | ) 19 | 20 | // GseCut gse cut token structure 21 | type GseCut struct { 22 | seg *gse.Segmenter 23 | // stop string 24 | opt string 25 | trim string 26 | } 27 | 28 | // Separator type separator tokenizer struct 29 | type Separator struct { 30 | seg *gse.Segmenter 31 | sep string 32 | trim string 33 | } 34 | 35 | // NewSep create a separator tokenizer 36 | func NewSep(sep, trim string) (*Separator, error) { 37 | var seg gse.Segmenter 38 | seg.Dict = gse.NewDict() 39 | seg.Init() 40 | return &Separator{&seg, sep, trim}, nil 41 | } 42 | 43 | // NewGseCut create a gse cut tokenizer 44 | func NewGse(dicts, stop, opt, trim string, alpha bool) (*GseCut, error) { 45 | var ( 46 | seg gse.Segmenter 47 | err error 48 | ) 49 | 50 | seg.SkipLog = true 51 | if alpha { 52 | seg.AlphaNum = true 53 | } 54 | 55 | if dicts == "" { 56 | dicts = "zh" 57 | } 58 | 59 | if strings.Contains(dicts, "embed") { 60 | dicts = strings.Replace(dicts, "embed, ", "", 1) 61 | err = seg.LoadDictEmbed(dicts) 62 | } else { 63 | err = seg.LoadDict(dicts) 64 | } 65 | 66 | if stop != "" { 67 | if strings.Contains(stop, "embed") { 68 | stop = strings.Replace(stop, "embed, ", "", 1) 69 | seg.LoadStopEmbed(stop) 70 | } else { 71 | seg.LoadStop(stop) 72 | } 73 | } 74 | return &GseCut{&seg, opt, trim}, err 75 | } 76 | 77 | // Trim trim the unused token string 78 | func (c *GseCut) Trim(s []string) []string { 79 | return Trim(s, c.trim, c.seg) 80 | } 81 | 82 | // Trim trim the unused token string 83 | func (c *Separator) Trim(s []string) []string { 84 | return Trim(s, c.trim, c.seg) 85 | } 86 | 87 | // Trim trim the unused token string 88 | func Trim(s []string, trim string, seg *gse.Segmenter) []string { 89 | if trim == "symbol" { 90 | return seg.TrimSymbol(s) 91 | } 92 | 93 | if trim == "punct" { 94 | return seg.TrimPunct(s) 95 | } 96 | 97 | if trim == "trim" { 98 | return seg.Trim(s) 99 | } 100 | 101 | return s 102 | } 103 | 104 | // Cut option the gse cut mode 105 | func (c *GseCut) Cut(text string, opt string) []string { 106 | if c.trim == "html" { 107 | return c.seg.CutTrimHtml(text) 108 | } 109 | 110 | if c.trim == "url" { 111 | return c.seg.CutUrl(text) 112 | } 113 | 114 | if opt == "search-hmm" { 115 | return c.seg.CutSearch(text, true) 116 | } 117 | if opt == "search" { 118 | return c.seg.CutSearch(text) 119 | } 120 | 121 | if opt == "search-dag" { 122 | return c.seg.CutSearch(text, false) 123 | } 124 | 125 | if opt == "all" { 126 | return c.seg.CutAll(text) 127 | } 128 | 129 | if opt == "hmm" { 130 | return c.seg.Cut(text, true) 131 | } 132 | 133 | if opt == "dag" { 134 | return c.seg.Cut(text, false) 135 | } 136 | 137 | return c.seg.Cut(text) 138 | } 139 | 140 | // Tokenize cut the text to bleve token stream 141 | func (c *GseCut) Tokenize(text []byte) analysis.TokenStream { 142 | result := make(analysis.TokenStream, 0) 143 | t1 := string(text) 144 | cuts := c.Trim(c.Cut(t1, c.opt)) 145 | 146 | azs := c.seg.Analyze(cuts, t1) 147 | for _, az := range azs { 148 | token := analysis.Token{ 149 | Term: []byte(az.Text), 150 | Start: az.Start, 151 | End: az.End, 152 | 153 | Position: az.Position, 154 | Type: analysis.Ideographic, 155 | } 156 | result = append(result, &token) 157 | } 158 | return result 159 | } 160 | 161 | // Tokenize cut the text to bleve token stream 162 | func (s *Separator) Tokenize(text []byte) analysis.TokenStream { 163 | result := make(analysis.TokenStream, 0) 164 | t1 := string(text) 165 | cuts := s.Trim(strings.Split(t1, s.sep)) 166 | 167 | azs := s.seg.Analyze(cuts, t1) 168 | for _, az := range azs { 169 | token := analysis.Token{ 170 | Term: []byte(az.Text), 171 | Start: az.Start, 172 | End: az.End, 173 | Position: az.Position, 174 | Type: analysis.Ideographic, 175 | } 176 | result = append(result, &token) 177 | } 178 | return result 179 | } 180 | 181 | func tokenizerConstructor(config map[string]interface{}, cache *registry.Cache) (analysis.Tokenizer, error) { 182 | dicts, ok := config["dicts"].(string) 183 | if !ok { 184 | dicts = "" 185 | } 186 | stop, ok := config["stop"].(string) 187 | if !ok { 188 | stop = "" 189 | } 190 | 191 | opt, ok := config["opt"].(string) 192 | if !ok || opt == "" { 193 | opt = "" 194 | } 195 | 196 | trim, ok := config["trim"].(string) 197 | if !ok { 198 | trim = "" 199 | } 200 | 201 | alpha, ok := config["alpha"].(bool) 202 | if !ok { 203 | alpha = false 204 | } 205 | 206 | return NewGse(dicts, stop, opt, trim, alpha) 207 | } 208 | 209 | func tokenizerConstructor2(config map[string]interface{}, cache *registry.Cache) (analysis.Tokenizer, error) { 210 | sep, ok := config["sep"].(string) 211 | if !ok { 212 | sep = " " 213 | } 214 | 215 | trim, ok := config["trim"].(string) 216 | if !ok { 217 | trim = "" 218 | } 219 | 220 | return NewSep(sep, trim) 221 | } 222 | 223 | func init() { 224 | registry.RegisterTokenizer(TokenName, tokenizerConstructor) 225 | registry.RegisterTokenizer(SeparateName, tokenizerConstructor2) 226 | } 227 | -------------------------------------------------------------------------------- /bleve_test.go: -------------------------------------------------------------------------------- 1 | package gsebleve 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "testing" 7 | "time" 8 | 9 | "github.com/blevesearch/bleve/v2" 10 | "github.com/vcaesar/tt" 11 | ) 12 | 13 | type data struct { 14 | Id string 15 | Title string 16 | Content string 17 | UpdateAt *time.Time 18 | } 19 | 20 | var text = "Seattle space needle, 多伦多 the CN Tower, 多伦多悬崖公园" 21 | 22 | func TestGse(t *testing.T) { 23 | indexName := "test.blv" 24 | os.RemoveAll(indexName) 25 | 26 | opt := Option{ 27 | Index: indexName, 28 | // Dicts: "embed, ja", 29 | Dicts: "embed, zh", 30 | Opt: "search-hmm", 31 | Trim: "trim", 32 | Stop: "", 33 | } 34 | 35 | // index, err := New(opt) 36 | // 37 | m1, err := NewMapping(opt) 38 | tt.Nil(t, err) 39 | docMap := bleve.NewDocumentMapping() 40 | m2 := NewTextMap() 41 | m2.IncludeTermVectors = true 42 | docMap.AddFieldMappingsAt("title", m2) 43 | m1.AddDocumentMapping("text1", docMap) 44 | 45 | index, err := bleve.New(opt.Index, m1) 46 | tt.Nil(t, err) 47 | 48 | err = index.Index("10", text) 49 | tt.Nil(t, err) 50 | err = index.Index("1", "西雅图太空针") 51 | tt.Nil(t, err) 52 | 53 | for i := 0; i < 10; i++ { 54 | t1 := time.Now() 55 | d1 := data{ 56 | Id: "10" + fmt.Sprint(i), 57 | Title: text + fmt.Sprint(i), 58 | Content: text, 59 | UpdateAt: &t1, 60 | } 61 | 62 | err = index.Index(d1.Id, d1) 63 | tt.Nil(t, err) 64 | } 65 | 66 | qry := "Seattle" 67 | req := bleve.NewSearchRequest(bleve.NewQueryStringQuery(qry)) 68 | req.Size = 20 69 | req.Highlight = bleve.NewHighlight() 70 | res, err := index.Search(req) 71 | tt.Nil(t, err) 72 | tt.Equal(t, 11, res.Total) 73 | fmt.Println("res: ", res) 74 | 75 | tt.Equal(t, 11, res.Hits.Len()) 76 | tt.Equal(t, "map[]", res.Hits[0].Fragments) 77 | tt.Equal(t, "[]", res.Request.Fields) 78 | tt.Equal(t, indexName, res.Hits[0].Index) 79 | 80 | os.RemoveAll(indexName) 81 | } 82 | -------------------------------------------------------------------------------- /circle.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | jobs: 4 | build: 5 | docker: 6 | - image: golang:1.21.0 7 | working_directory: /gopath/src/github.com/vcaesar/gse-bleve 8 | steps: 9 | - checkout 10 | # specify any bash command here prefixed with `run: ` 11 | - run: go get -v -t -d ./... 12 | - run: go test -v ./... 13 | # codecov.io 14 | - run: go test -v -covermode=count -coverprofile=coverage.out 15 | - run: bash <(curl -s https://codecov.io/bash) 16 | -------------------------------------------------------------------------------- /examples/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | 7 | "github.com/blevesearch/bleve/v2" 8 | gseb "github.com/vcaesar/gse-bleve" 9 | ) 10 | 11 | func main() { 12 | opt := gseb.Option{ 13 | Index: "test.blv", 14 | // Dicts: "embed, zh", 15 | Dicts: "embed, ja", 16 | Stop: "", 17 | Opt: "search-hmm", 18 | Trim: "trim", 19 | } 20 | 21 | index, err := gseb.New(opt) 22 | if err != nil { 23 | fmt.Println("new mapping error is: ", err) 24 | return 25 | } 26 | 27 | text := `見解では、謙虚なヴォードヴィリアンのベテランは、運命の犠牲者と悪役の両方の変遷として代償を払っています` 28 | err = index.Index("1", text) 29 | 30 | index.Index("13", "間違っていたのは俺じゃない、世界の方だ") 31 | index.Index("3", text+"浮き沈み") 32 | index.Index("10", text+"両方の変遷") 33 | index.Index("4", `In view, a humble vaudevillian veteran cast vicariously as both victim and villain vicissitudes of fate.`) 34 | index.Index("2", `It's difficult to understand the sum of a person's life.`) 35 | if err != nil { 36 | fmt.Println("index error: ", err) 37 | } 38 | 39 | query := "運命の犠牲者" 40 | req := bleve.NewSearchRequest(bleve.NewQueryStringQuery(query)) 41 | 42 | req.Highlight = bleve.NewHighlight() 43 | req.Size = 20 44 | res, err := index.Search(req) 45 | fmt.Println("res: ", res, err, res.Hits) 46 | 47 | os.RemoveAll("test.blv") 48 | } 49 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/vcaesar/gse-bleve 2 | 3 | go 1.17 4 | 5 | require ( 6 | github.com/blevesearch/bleve/v2 v2.3.9 7 | github.com/go-ego/gse v0.70.2 8 | github.com/vcaesar/tt v0.20.0 9 | ) 10 | 11 | require ( 12 | github.com/RoaringBitmap/roaring v1.2.3 // indirect 13 | github.com/bits-and-blooms/bitset v1.4.0 // indirect 14 | github.com/blevesearch/bleve_index_api v1.0.5 // indirect 15 | github.com/blevesearch/geo v0.1.17 // indirect 16 | github.com/blevesearch/go-porterstemmer v1.0.3 // indirect 17 | github.com/blevesearch/gtreap v0.1.1 // indirect 18 | github.com/blevesearch/mmap-go v1.0.4 // indirect 19 | github.com/blevesearch/scorch_segment_api/v2 v2.1.5 // indirect 20 | github.com/blevesearch/segment v0.9.1 // indirect 21 | github.com/blevesearch/snowballstem v0.9.0 // indirect 22 | github.com/blevesearch/upsidedown_store_api v1.0.2 // indirect 23 | github.com/blevesearch/vellum v1.0.10 // indirect 24 | github.com/blevesearch/zapx/v11 v11.3.9 // indirect 25 | github.com/blevesearch/zapx/v12 v12.3.9 // indirect 26 | github.com/blevesearch/zapx/v13 v13.3.9 // indirect 27 | github.com/blevesearch/zapx/v14 v14.3.9 // indirect 28 | github.com/blevesearch/zapx/v15 v15.3.12 // indirect 29 | github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect 30 | github.com/golang/protobuf v1.5.2 // indirect 31 | github.com/golang/snappy v0.0.4 // indirect 32 | github.com/json-iterator/go v1.1.12 // indirect 33 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect 34 | github.com/modern-go/reflect2 v1.0.2 // indirect 35 | github.com/mschoch/smat v0.2.0 // indirect 36 | github.com/vcaesar/cedar v0.20.1 // indirect 37 | go.etcd.io/bbolt v1.3.7 // indirect 38 | golang.org/x/sys v0.4.0 // indirect 39 | google.golang.org/protobuf v1.28.1 // indirect 40 | ) 41 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/RoaringBitmap/roaring v1.2.3 h1:yqreLINqIrX22ErkKI0vY47/ivtJr6n+kMhVOVmhWBY= 2 | github.com/RoaringBitmap/roaring v1.2.3/go.mod h1:plvDsJQpxOC5bw8LRteu/MLWHsHez/3y6cubLI4/1yE= 3 | github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= 4 | github.com/bits-and-blooms/bitset v1.4.0 h1:+YZ8ePm+He2pU3dZlIZiOeAKfrBkXi1lSrXJ/Xzgbu8= 5 | github.com/bits-and-blooms/bitset v1.4.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= 6 | github.com/blevesearch/bleve/v2 v2.3.9 h1:pUMvK0mxAexqasZcVj8lazmWnEW5XiV0tASIqANiNTQ= 7 | github.com/blevesearch/bleve/v2 v2.3.9/go.mod h1:1PibElcjlQMQHF9uS9mRv58ODQgj4pCWHA1Wfd+qagU= 8 | github.com/blevesearch/bleve_index_api v1.0.5 h1:Lc986kpC4Z0/n1g3gg8ul7H+lxgOQPcXb9SxvQGu+tw= 9 | github.com/blevesearch/bleve_index_api v1.0.5/go.mod h1:YXMDwaXFFXwncRS8UobWs7nvo0DmusriM1nztTlj1ms= 10 | github.com/blevesearch/geo v0.1.17 h1:AguzI6/5mHXapzB0gE9IKWo+wWPHZmXZoscHcjFgAFA= 11 | github.com/blevesearch/geo v0.1.17/go.mod h1:uRMGWG0HJYfWfFJpK3zTdnnr1K+ksZTuWKhXeSokfnM= 12 | github.com/blevesearch/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:9eJDeqxJ3E7WnLebQUlPD7ZjSce7AnDb9vjGmMCbD0A= 13 | github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= 14 | github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= 15 | github.com/blevesearch/goleveldb v1.0.1/go.mod h1:WrU8ltZbIp0wAoig/MHbrPCXSOLpe79nz5lv5nqfYrQ= 16 | github.com/blevesearch/gtreap v0.1.1 h1:2JWigFrzDMR+42WGIN/V2p0cUvn4UP3C4Q5nmaZGW8Y= 17 | github.com/blevesearch/gtreap v0.1.1/go.mod h1:QaQyDRAT51sotthUWAH4Sj08awFSSWzgYICSZ3w0tYk= 18 | github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= 19 | github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc= 20 | github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs= 21 | github.com/blevesearch/scorch_segment_api/v2 v2.1.5 h1:1g713kpCQZ8u4a3stRGBfrwVOuGRnmxOVU5MQkUPrHU= 22 | github.com/blevesearch/scorch_segment_api/v2 v2.1.5/go.mod h1:f2nOkKS1HcjgIWZgDAErgBdxmr2eyt0Kn7IY+FU1Xe4= 23 | github.com/blevesearch/segment v0.9.1 h1:+dThDy+Lvgj5JMxhmOVlgFfkUtZV2kw49xax4+jTfSU= 24 | github.com/blevesearch/segment v0.9.1/go.mod h1:zN21iLm7+GnBHWTao9I+Au/7MBiL8pPFtJBJTsk6kQw= 25 | github.com/blevesearch/snowball v0.6.1/go.mod h1:ZF0IBg5vgpeoUhnMza2v0A/z8m1cWPlwhke08LpNusg= 26 | github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= 27 | github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= 28 | github.com/blevesearch/upsidedown_store_api v1.0.2 h1:U53Q6YoWEARVLd1OYNc9kvhBMGZzVrdmaozG2MfoB+A= 29 | github.com/blevesearch/upsidedown_store_api v1.0.2/go.mod h1:M01mh3Gpfy56Ps/UXHjEO/knbqyQ1Oamg8If49gRwrQ= 30 | github.com/blevesearch/vellum v1.0.10 h1:HGPJDT2bTva12hrHepVT3rOyIKFFF4t7Gf6yMxyMIPI= 31 | github.com/blevesearch/vellum v1.0.10/go.mod h1:ul1oT0FhSMDIExNjIxHqJoGpVrBpKCdgDQNxfqgJt7k= 32 | github.com/blevesearch/zapx/v11 v11.3.9 h1:y3ijS4h4MJdmQ07MHASxat4owAixreK2xdo76w9ncrw= 33 | github.com/blevesearch/zapx/v11 v11.3.9/go.mod h1:jcAYnQwlr+LqD2vLjDWjWiZDXDXGFqPbpPDRTd3XmS4= 34 | github.com/blevesearch/zapx/v12 v12.3.9 h1:MXGLlZ03oxXH3DMJTZaBaRj2xb6t4wQVZeZK/wu1M6w= 35 | github.com/blevesearch/zapx/v12 v12.3.9/go.mod h1:QXCMwmOkdLnMDgTN1P4CcuX5F851iUOtOwXbw0HMBYs= 36 | github.com/blevesearch/zapx/v13 v13.3.9 h1:+VAz9V0VmllHXlZV4DCvfYj0nqaZHgF3MeEHwOyRBwQ= 37 | github.com/blevesearch/zapx/v13 v13.3.9/go.mod h1:s+WjNp4WSDtrBVBpa37DUOd7S/Gr/jTZ7ST/MbCVj/0= 38 | github.com/blevesearch/zapx/v14 v14.3.9 h1:wuqxATgsTCNHM9xsOFOeFp8H2heZ/gMX/tsl9lRK8U4= 39 | github.com/blevesearch/zapx/v14 v14.3.9/go.mod h1:MWZ4v8AzFBRurhDzkLvokFW8ljcq9Evm27mkWe8OGbM= 40 | github.com/blevesearch/zapx/v15 v15.3.12 h1:w/kU9aHyfMDEdwHGZzCiakC3HZ9z5gYlXaALDC4Dct8= 41 | github.com/blevesearch/zapx/v15 v15.3.12/go.mod h1:tx53gDJS/7Oa3Je820cmVurqCuJ4dqdAy1kiDMV/IUo= 42 | github.com/couchbase/ghistogram v0.1.0/go.mod h1:s1Jhy76zqfEecpNWJfWUiKZookAFaiGOEoyzgHt9i7k= 43 | github.com/couchbase/moss v0.2.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs= 44 | github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 45 | github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 46 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 47 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 48 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 49 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= 50 | github.com/go-ego/gse v0.70.2 h1:y2UMOHJMtI+0b2GjxTtQfKON5DMmlyX1hOQHTo8UVVs= 51 | github.com/go-ego/gse v0.70.2/go.mod h1:kesekpZfcFQ/kwd9b27VZHUOH5dQUjaaQUZ4OGt4Hj4= 52 | github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo= 53 | github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= 54 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 55 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= 56 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= 57 | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= 58 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= 59 | github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 60 | github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 61 | github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= 62 | github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= 63 | github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= 64 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= 65 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 66 | github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= 67 | github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= 68 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= 69 | github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= 70 | github.com/json-iterator/go v0.0.0-20171115153421-f7279a603ede/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= 71 | github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= 72 | github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= 73 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 74 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= 75 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= 76 | github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= 77 | github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= 78 | github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM= 79 | github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= 80 | github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= 81 | github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= 82 | github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= 83 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 84 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 85 | github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 86 | github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= 87 | github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= 88 | github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 89 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 90 | github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= 91 | github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= 92 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= 93 | github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 94 | github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 95 | github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= 96 | github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= 97 | github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= 98 | github.com/vcaesar/cedar v0.20.1 h1:cDOmYWdprO7ZW8cngJrDi8Zivnscj9dA/y8Y+2SB1P0= 99 | github.com/vcaesar/cedar v0.20.1/go.mod h1:iMDweyuW76RvSrCkQeZeQk4iCbshiPzcCvcGCtpM7iI= 100 | github.com/vcaesar/tt v0.20.0 h1:9t2Ycb9RNHcP0WgQgIaRKJBB+FrRdejuaL6uWIHuoBA= 101 | github.com/vcaesar/tt v0.20.0/go.mod h1:GHPxQYhn+7OgKakRusH7KJ0M5MhywoeLb8Fcffs/Gtg= 102 | github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= 103 | go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= 104 | go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= 105 | go.etcd.io/gofail v0.1.0/go.mod h1:VZBCXYGZhHAinaBiiqYvuDynvahNsAyLFwB3kEHKz1M= 106 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 107 | golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= 108 | golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= 109 | golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 110 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 111 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= 112 | golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= 113 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 114 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 115 | golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 116 | golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 117 | golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 118 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 119 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 120 | golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 121 | golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 122 | golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 123 | golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= 124 | golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 125 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= 126 | golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= 127 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 128 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 129 | golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 130 | golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= 131 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= 132 | golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 133 | golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= 134 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 135 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= 136 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 137 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= 138 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 139 | google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= 140 | google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= 141 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 142 | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= 143 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= 144 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 145 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= 146 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 147 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= 148 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 149 | -------------------------------------------------------------------------------- /index.go: -------------------------------------------------------------------------------- 1 | // Copyright 2016 Evans. All rights reserved. 2 | // Use of this source code is governed by a BSD-style 3 | // license that can be found in the LICENSE file. 4 | 5 | package gsebleve 6 | 7 | import ( 8 | "github.com/blevesearch/bleve/v2" 9 | "github.com/blevesearch/bleve/v2/mapping" 10 | ) 11 | 12 | // Option gse bleve option structure 13 | type Option struct { 14 | Index string 15 | Dicts, Stop, Opt, Trim string 16 | Alpha bool 17 | Name, Sep string 18 | } 19 | 20 | // NewMappingSep new separator mapping 21 | func NewMappingSep(sep string, trim ...string) (*mapping.IndexMappingImpl, error) { 22 | mapping1 := bleve.NewIndexMapping() 23 | trimOpt := "" 24 | if len(trim) > 0 { 25 | trimOpt = trim[0] 26 | } 27 | 28 | err := mapping1.AddCustomTokenizer(SeparateName, map[string]interface{}{ 29 | "type": SeparateName, 30 | "sep": sep, 31 | "trim": trimOpt, 32 | }) 33 | if err != nil { 34 | return nil, err 35 | } 36 | 37 | err = mapping1.AddCustomAnalyzer(SeparateName, map[string]interface{}{ 38 | "type": SeparateName, 39 | "tokenizer": SeparateName, 40 | }) 41 | if err != nil { 42 | return nil, err 43 | } 44 | 45 | mapping1.DefaultAnalyzer = SeparateName 46 | return mapping1, nil 47 | } 48 | 49 | // NewMapping new bleve index mapping 50 | func NewMapping(opt Option) (*mapping.IndexMappingImpl, error) { 51 | mapping1 := bleve.NewIndexMapping() 52 | 53 | err := mapping1.AddCustomTokenizer(TokenName, map[string]interface{}{ 54 | "type": TokenName, 55 | "dicts": opt.Dicts, 56 | "stop": opt.Stop, 57 | "opt": opt.Opt, 58 | "trim": opt.Trim, 59 | "alpha": opt.Alpha, 60 | }) 61 | 62 | if err != nil { 63 | return nil, err 64 | } 65 | 66 | err = mapping1.AddCustomAnalyzer(TokenName, map[string]interface{}{ 67 | "type": TokenName, 68 | "tokenizer": TokenName, 69 | }) 70 | 71 | if err != nil { 72 | return nil, err 73 | } 74 | 75 | mapping1.DefaultAnalyzer = TokenName 76 | return mapping1, nil 77 | } 78 | 79 | // New new bleve index 80 | func New(opt Option) (bleve.Index, error) { 81 | var ( 82 | mapping1 *mapping.IndexMappingImpl 83 | err error 84 | ) 85 | if opt.Name == "sep" { 86 | mapping1, err = NewMappingSep(opt.Sep, opt.Trim) 87 | } else { 88 | mapping1, err = NewMapping(opt) 89 | } 90 | if err != nil { 91 | return nil, err 92 | } 93 | 94 | return bleve.New(opt.Index, mapping1) 95 | } 96 | 97 | // NewMem new bleve index only memory 98 | func NewMem(opt Option) (bleve.Index, error) { 99 | mapping1, err := NewMapping(opt) 100 | if err != nil { 101 | return nil, err 102 | } 103 | 104 | return bleve.NewMemOnly(mapping1) 105 | } 106 | 107 | // NewDoc new bleve index document mapping 108 | func NewDoc() *mapping.DocumentMapping { 109 | return bleve.NewDocumentMapping() 110 | } 111 | 112 | // NewTextMap new text field mapping with gse 113 | func NewTextMap() *mapping.FieldMapping { 114 | return &mapping.FieldMapping{ 115 | Type: "text", 116 | Analyzer: "gse", 117 | Store: true, 118 | Index: true, 119 | IncludeInAll: true, 120 | DocValues: true, 121 | } 122 | } 123 | 124 | // NewSepMap new text field mapping with sep 125 | func NewSepMap() *mapping.FieldMapping { 126 | return &mapping.FieldMapping{ 127 | Type: "text", 128 | Analyzer: "sep", 129 | Store: true, 130 | Index: true, 131 | IncludeInAll: true, 132 | DocValues: true, 133 | } 134 | } 135 | --------------------------------------------------------------------------------