riot
riot copied to clipboard
What is the function of the DocData field Attri? How to store Attri?
type DocData struct {
...
Attri interface{}
...
}
- What is the function of the Attri ?
- I test to store the Attri , but it was fail. Flow is the code:
type parentInfo struct{
Name string
Id int64
}
type resIndexNode struct {
Id int64
Name string
Attr []parentInfo
}
...
searcher.Init(types.EngineOpts{
Using: 3,
UseStore: true,
StoreFolder:dataPath,
})
...
func addIndex(rin*resIndexNode) {
searcher.Index(uint64(rin.Id), types.DocData{Content: rin.Name,Attri:rin.Attr},true)
searcher.Flush()
}
reload index:
func reloadIndex(dataPath string) {
searcher.Init(types.EngineOpts{
Using: 3,
UseStore: true,
StoreFolder:dataPath,
})
searcher.FlushIndex()
log.Println("recover index number: ", searcher.NumDocsIndexed())
}
searcher.NumDocsIndexed() is 0
I reproduced your question, I will update it.