Go是否有Lucene软件包?

swa*_*eck 5 lucene go

鉴于Go的命名相当纯真,Google搜索这样的软件包对于我搜索Go的Lucene软件包只会产生一个可辨别的结果:这个没有提交

有人知道Go的任何Lucene端口吗?

fem*_*gon 5

我认为,这个Go SOLR库看起来很有希望。

https://github.com/rtt/Go-Solr/

看起来有点偏瘦,但可能会带您到某个地方。

或者,与Elasticsearch类似的故事:

https://github.com/dustin/go-elasticsearch


小智 5

还有另一个文本索引库,可以实现

特征与lucene非常相似。

索引编制

message := struct{
    Id   string
    From string
    Body string
}{
    Id:   "example",
    From: "marty.schoch@gmail.com",
    Body: "bleve indexing is easy",
}

mapping := bleve.NewIndexMapping()
index, err := bleve.New("example.bleve", mapping)
if err != nil {
    panic(err)
}
index.Index(message.Id, message)
Run Code Online (Sandbox Code Playgroud)

查询方式

index, _ := bleve.Open("example.bleve")
query := bleve.NewQueryStringQuery("bleve")
searchRequest := bleve.NewSearchRequest(query)
searchResult, _ := index.Search(searchRequest)
Run Code Online (Sandbox Code Playgroud)