Documentation ¶
Index ¶
- Constants
- type Engine
- func (engine *Engine) Close()
- func (engine *Engine) FlushIndex()
- func (engine *Engine) IndexDocument(docId uint64, data types.DocumentIndexData)
- func (engine *Engine) Init(options types.EngineInitOptions)
- func (engine *Engine) NumDocumentsIndexed() uint64
- func (engine *Engine) NumTokenIndexAdded() uint64
- func (engine *Engine) RemoveDocument(docId uint64)
- func (engine *Engine) Search(request types.SearchRequest) (output types.SearchResponse)
- func (engine *Engine) Segment(content string) (keywords []string)
- type StopTokens
Constants ¶
View Source
const (
PersistentStorageFilePrefix = "wukong"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) IndexDocument ¶
func (engine *Engine) IndexDocument(docId uint64, data types.DocumentIndexData)
将文档加入索引
输入参数:
docId 标识文档编号,必须唯一 data 见DocumentIndexData注释
注意:
- 这个函数是线程安全的,请尽可能并发调用以提高索引速度
- 这个函数调用是非同步的,也就是说在函数返回时有可能文档还没有加入索引中,因此 如果立刻调用Search可能无法查询到这个文档。强制刷新索引请调用FlushIndex函数。
func (*Engine) Init ¶
func (engine *Engine) Init(options types.EngineInitOptions)
func (*Engine) NumDocumentsIndexed ¶
func (*Engine) NumTokenIndexAdded ¶
func (*Engine) Search ¶
func (engine *Engine) Search(request types.SearchRequest) (output types.SearchResponse)
查找满足搜索条件的文档,此函数线程安全
type StopTokens ¶
type StopTokens struct {
// contains filtered or unexported fields
}
func (*StopTokens) Init ¶
func (st *StopTokens) Init(stopTokenFile string)
从stopTokenFile中读入停用词,一个词一行 文档索引建立时会跳过这些停用词
func (*StopTokens) IsStopToken ¶
func (st *StopTokens) IsStopToken(token string) bool
Click to show internal directories.
Click to hide internal directories.