riot icon indicating copy to clipboard operation
riot copied to clipboard

What is the function of the DocData field Attri? How to store Attri?

Open yale8848 opened this issue 7 years ago • 1 comments

type DocData struct {
    ...
    Attri interface{}
    ...
}
  1. What is the function of the Attri ?
  2. 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

yale8848 avatar Aug 19 '18 02:08 yale8848

I reproduced your question, I will update it.

vcaesar avatar Aug 19 '18 17:08 vcaesar