Documentation ¶
Index ¶
- Variables
- func AddDocInfo(shard int, docId uint64, docinfo *types.DocInfo)
- func AddDocInfosShard(shard int)
- func AddInvertedIndexShard(shard int)
- func AddKeywordIndices(shard int, keyword string, keywordIndices *types.KeywordIndices)
- type Indexer
- func (indexer *Indexer) AddDocument(document *types.DocumentIndex, dealDocInfoChan chan<- bool) (addInvertedIndex map[string]*types.KeywordIndices)
- func (indexer *Indexer) Init(shard int, options types.IndexerInitOptions)
- func (indexer *Indexer) Lookup(tokens []string, labels []string, docIds map[uint64]bool, countDocsOnly bool) (docs []types.IndexedDocument, numDocs int)
- func (indexer *Indexer) RemoveDoc(docId uint64)
- type Ranker
- func (ranker *Ranker) AddDoc(docId uint64, fields interface{}, dealDocInfoChan <-chan bool) *types.DocInfo
- func (ranker *Ranker) Init(shard int)
- func (ranker *Ranker) Rank(docs []types.IndexedDocument, options types.RankOptions, countDocsOnly bool) (types.ScoredDocuments, int)
- func (ranker *Ranker) RemoveDoc(docId uint64)
Constants ¶
This section is empty.
Variables ¶
View Source
var DocInfoGroup = make(map[int]*types.DocInfosShard)
文档信息[shard][id]info
View Source
var InvertedIndexGroup = make(map[int]*types.InvertedIndexShard)
反向索引表([shard][关键词]反向索引表)
Functions ¶
func AddDocInfosShard ¶
func AddDocInfosShard(shard int)
func AddInvertedIndexShard ¶
func AddInvertedIndexShard(shard int)
func AddKeywordIndices ¶
func AddKeywordIndices(shard int, keyword string, keywordIndices *types.KeywordIndices)
Types ¶
type Indexer ¶
type Indexer struct { // 文档信息 *types.DocInfosShard // 反向索引 *types.InvertedIndexShard // contains filtered or unexported fields }
索引器
func (*Indexer) AddDocument ¶
func (indexer *Indexer) AddDocument(document *types.DocumentIndex, dealDocInfoChan chan<- bool) (addInvertedIndex map[string]*types.KeywordIndices)
向反向索引表中加入一个文档
func (*Indexer) Init ¶
func (indexer *Indexer) Init(shard int, options types.IndexerInitOptions)
初始化索引器
type Ranker ¶
type Ranker struct { // 文档信息 *types.DocInfosShard // contains filtered or unexported fields }
func (*Ranker) AddDoc ¶
func (ranker *Ranker) AddDoc(docId uint64, fields interface{}, dealDocInfoChan <-chan bool) *types.DocInfo
给某个文档添加评分字段
func (*Ranker) Rank ¶
func (ranker *Ranker) Rank( docs []types.IndexedDocument, options types.RankOptions, countDocsOnly bool) (types.ScoredDocuments, int)
给文档评分并排序
Click to show internal directories.
Click to hide internal directories.