Documentation ¶
Overview ¶
Package core is riot core
Index ¶
- Constants
- Variables
- func AddDocInfo(shard int, docId string, docinfo *types.DocInfo)
- func AddDocInfosShard(shard int)
- func AddInvertedIndexShard(shard int)
- func AddKeywordIndices(shard int, keyword string, keywordIndices *types.KeywordIndices)
- func Asc(data []uint64)
- func Desc(data []uint64)
- func IsDocExist(docId string) bool
- func IsSortedAsc(data []uint64) bool
- func IsSortedDesc(data []uint64) bool
- func StableAsc(data []uint64)
- func StableDesc(data []uint64)
- type Indexer
- func (indexer *Indexer) AddDocToCache(doc *types.DocIndex, forceUpdate bool)
- func (indexer *Indexer) AddDocs(docs *types.DocsIndex)
- func (indexer *Indexer) AddTiKvDocs(docs *types.DocsIndex)
- func (indexer *Indexer) HasDoc(docId string) bool
- func (indexer *Indexer) Init(options types.IndexerOpts)
- func (indexer *Indexer) LogicLookup(docIds map[string]bool, countDocsOnly bool, logicExpr []string, ...) (docs []types.IndexedDoc, numDocs int)
- func (indexer *Indexer) Lookup(tokens, labels []string, docIds map[string]bool, countDocsOnly bool, ...) (docs []types.IndexedDoc, numDocs int)
- func (indexer *Indexer) RemoveDocToCache(docId string, forceUpdate bool) bool
- func (indexer *Indexer) RemoveDocs(docs *types.DocsId)
- func (indexer *Indexer) RemoveTiKvDocs(docs *types.DocsId)
- func (indexer *Indexer) SetTikv(t *tikv.Tikv, prefix string)
- type KeywordIndexKv
- type KeywordIndices
- type Ranker
- func (ranker *Ranker) AddDoc(docId string, fields interface{}, content ...interface{})
- func (ranker *Ranker) AddTiKvDoc(docId string, fields interface{})
- func (ranker *Ranker) GetTiKvDoc(docId string) (interface{}, bool)
- func (ranker *Ranker) Init(onlyID ...bool)
- func (ranker *Ranker) Rank(docs []types.IndexedDoc, options types.RankOpts, countDocsOnly bool) (interface{}, int)
- func (ranker *Ranker) RankDocID(docs []types.IndexedDoc, options types.RankOpts, countDocsOnly bool) (types.ScoredIDs, int)
- func (ranker *Ranker) RankDocs(docs []types.IndexedDoc, options types.RankOpts, countDocsOnly bool) (types.ScoredDocs, int)
- func (ranker *Ranker) RemoveDoc(docId string)
- func (ranker *Ranker) RemoveTiKvDoc(docId string)
- func (ranker *Ranker) SetTikv(t *tikv.Tikv, prefix string)
Constants ¶
View Source
const RankerDocId = "ranker:doc_id:"
View Source
const TiKvDocIndex = "doc:index:"
View Source
const TiKvDocKeys = "doc:keys:"
Variables ¶
View Source
var ( // DocInfoGroup 文档信息 [shard][id]info DocInfoGroup = make(map[int]*types.DocInfosShard) )
View Source
var ( // InvertedIndexGroup 反向索引表([shard][关键词]反向索引表) InvertedIndexGroup = make(map[int]*types.InvertedIndexShard) )
Functions ¶
func AddDocInfo ¶
AddDocInfo add documents info
func AddInvertedIndexShard ¶
func AddInvertedIndexShard(shard int)
AddInvertedIndexShard add inverted index shard
func AddKeywordIndices ¶
func AddKeywordIndices(shard int, keyword string, keywordIndices *types.KeywordIndices)
AddKeywordIndices add keyword indices
Types ¶
type Indexer ¶
type Indexer struct {
// contains filtered or unexported fields
}
Indexer 索引器
func (*Indexer) AddDocToCache ¶
AddDocToCache 向 ADDCACHE 中加入一个文档
func (*Indexer) AddTiKvDocs ¶
func (*Indexer) LogicLookup ¶
func (indexer *Indexer) LogicLookup( docIds map[string]bool, countDocsOnly bool, logicExpr []string, logic types.Logic) (docs []types.IndexedDoc, numDocs int)
LogicLookup logic Lookup
func (*Indexer) Lookup ¶
func (indexer *Indexer) Lookup( tokens, labels []string, docIds map[string]bool, countDocsOnly bool, logic ...types.Logic) (docs []types.IndexedDoc, numDocs int)
Lookup lookup docs 查找包含全部搜索键(AND操作)的文档 当 docIds 不为 nil 时仅从 docIds 指定的文档中查找
func (*Indexer) RemoveDocToCache ¶
RemoveDocToCache 向 REMOVECACHE 中加入一个待删除文档 返回值表示文档是否在索引表中被删除
func (*Indexer) RemoveDocs ¶
RemoveDocs 向反向索引表中删除 REMOVECACHE 中所有文档
func (*Indexer) RemoveTiKvDocs ¶
type KeywordIndexKv ¶
type KeywordIndexKv struct {
// contains filtered or unexported fields
}
用于存储于K-V结构
type KeywordIndices ¶
type KeywordIndices struct {
// contains filtered or unexported fields
}
KeywordIndices 反向索引表的一行,收集了一个搜索键出现的所有文档,按照DocId从小到大排序。
type Ranker ¶
type Ranker struct {
// contains filtered or unexported fields
}
Ranker ranker
func (*Ranker) AddTiKvDoc ¶
func (*Ranker) GetTiKvDoc ¶
RemoveDoc 删除某个文档的评分字段
func (*Ranker) Rank ¶
func (ranker *Ranker) Rank(docs []types.IndexedDoc, options types.RankOpts, countDocsOnly bool) (interface{}, int)
Rank rank docs 给文档评分并排序
func (*Ranker) RankDocID ¶
func (ranker *Ranker) RankDocID(docs []types.IndexedDoc, options types.RankOpts, countDocsOnly bool) (types.ScoredIDs, int)
RankDocID rank docs by types.ScoredIDs
func (*Ranker) RankDocs ¶
func (ranker *Ranker) RankDocs(docs []types.IndexedDoc, options types.RankOpts, countDocsOnly bool) (types.ScoredDocs, int)
RankDocs rank docs by types.ScoredDocs
func (*Ranker) RemoveTiKvDoc ¶
RemoveDoc 删除某个文档的评分字段
Click to show internal directories.
Click to hide internal directories.