sorry 写错了 有需要去看这个吧
https://github.com/ttys3/gojieba-bleve/blob/master/bleve_test.go
1.引用包
import (
"fmt"
"github.com/yanyiwu/gojieba"
"os"
"strconv"
"strings"
"testing"
"time"
"github.com/blevesearch/bleve/v2"
"github.com/blevesearch/bleve/v2/analysis/analyzer/keyword"
)
2.初始化bleve
var indexName string = "userIndex"
//创建索引
func TestCreate(t *testing.T) {
os.RemoveAll(indexName)
// open a new index
mapping := bleve.NewIndexMapping()
//userMapping := bleve.NewDocumentMapping()
//userMapping.AddFieldMappingsAt("Address", bleve.NewBooleanFieldMapping())
//mapping.DefaultMapping = userMapping
// Address的

最低0.47元/天 解锁文章
656

被折叠的 条评论
为什么被折叠?



