core

package
v0.0.0-...-111ab80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package core is riot core

Index

Constants

This section is empty.

Variables

View Source
var DocInfoGroup = make(map[int]*types.DocInfosShard)

DocInfoGroup 文档信息[shard][id]info

View Source
var InvertedIndexGroup = make(map[int]*types.InvertedIndexShard)

InvertedIndexGroup 反向索引表([shard][关键词]反向索引表)

Functions

func AddDocInfo

func AddDocInfo(shard int, docId uint64, docinfo *types.DocInfo)

func AddDocInfosShard

func AddDocInfosShard(shard int)

func AddInvertedIndexShard

func AddInvertedIndexShard(shard int)

func AddKeywordIndices

func AddKeywordIndices(shard int, keyword string, keywordIndices *types.KeywordIndices)

func Asc

func Asc(data []uint64)

func Desc

func Desc(data []uint64)

func IsSortedAsc

func IsSortedAsc(data []uint64) bool

func IsSortedDesc

func IsSortedDesc(data []uint64) bool

func StableAsc

func StableAsc(data []uint64)

func StableDesc

func StableDesc(data []uint64)

Types

type Indexer

type Indexer struct {
	// contains filtered or unexported fields
}

索引器

func (*Indexer) AddDocumentToCache

func (indexer *Indexer) AddDocumentToCache(document *types.DocumentIndex, forceUpdate bool)

向 ADDCACHE 中加入一个文档

func (*Indexer) AddDocuments

func (indexer *Indexer) AddDocuments(documents *types.DocumentsIndex)

向反向索引表中加入 ADDCACHE 中所有文档

func (*Indexer) Init

func (indexer *Indexer) Init(options types.IndexerInitOptions)

初始化索引器

func (*Indexer) LogicLookup

func (indexer *Indexer) LogicLookup(
	docIds map[uint64]bool, countDocsOnly bool, LogicExpression []string,
	logic types.Logic) (docs []types.IndexedDocument, numDocs int)

LogicLookup logic Lookup

func (*Indexer) Lookup

func (indexer *Indexer) Lookup(
	tokens []string, labels []string, docIds map[uint64]bool, countDocsOnly bool,
	logic ...types.Logic) (docs []types.IndexedDocument, numDocs int)

Lookup lookup 查找包含全部搜索键(AND操作)的文档 当docIds不为nil时仅从docIds指定的文档中查找

func (*Indexer) RemoveDocumentToCache

func (indexer *Indexer) RemoveDocumentToCache(docId uint64, forceUpdate bool) bool

向 REMOVECACHE 中加入一个待删除文档 返回值表示文档是否在索引表中被删除

func (*Indexer) RemoveDocuments

func (indexer *Indexer) RemoveDocuments(documents *types.DocumentsId)

向反向索引表中删除 REMOVECACHE 中所有文档

type KeywordIndices

type KeywordIndices struct {
	// contains filtered or unexported fields
}

反向索引表的一行,收集了一个搜索键出现的所有文档,按照DocId从小到大排序。

type Ranker

type Ranker struct {
	// contains filtered or unexported fields
}

func (*Ranker) AddDoc

func (ranker *Ranker) AddDoc(
	docId uint64, fields interface{}, content string, attri interface{})

AddDoc add doc 给某个文档添加评分字段

func (*Ranker) Init

func (ranker *Ranker) Init()

func (*Ranker) Rank

func (ranker *Ranker) Rank(
	docs []types.IndexedDocument, options types.RankOptions,
	countDocsOnly bool) (types.ScoredDocuments, int)

Rank rank 给文档评分并排序

func (*Ranker) RemoveDoc

func (ranker *Ranker) RemoveDoc(docId uint64)

删除某个文档的评分字段

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL