core

package
v0.1.1-0...-d12b490 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2015 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

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 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)

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)

初始化索引器

func (*Indexer) Lookup

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

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

func (*Indexer) RemoveDoc

func (indexer *Indexer) RemoveDoc(docId uint64)

删除某个文档(反向索引的删除太复杂故而不做,只在排序器中删除文档即可)

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) Init

func (ranker *Ranker) Init(shard int)

func (*Ranker) Rank

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

给文档评分并排序

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