searcher

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container struct {
	Dir string //文件夹

	Debug     bool             //调试
	Tokenizer *words.Tokenizer //分词器
	Shard     int              //分片
	Timeout   int64            //超时关闭数据库
	BufferNum int              //分片缓冲数
	// contains filtered or unexported fields
}

func (*Container) DropDataBase

func (c *Container) DropDataBase(name string) error

DropDataBase 删除数据库

func (*Container) GetDataBase

func (c *Container) GetDataBase(name string) *Engine

GetDataBase 获取或创建引擎

func (*Container) GetDataBaseNumber

func (c *Container) GetDataBaseNumber() int

func (*Container) GetDataBases

func (c *Container) GetDataBases() map[string]*Engine

GetDataBases 获取数据库列表

func (*Container) GetDocumentCount

func (c *Container) GetDocumentCount() int64

func (*Container) GetIndexCount

func (c *Container) GetIndexCount() int64

func (*Container) Init

func (c *Container) Init() error

func (*Container) NewEngine

func (c *Container) NewEngine(name string) *Engine

NewEngine 创建一个引擎

type Engine

type Engine struct {
	IndexPath string  //索引文件存储目录
	Option    *Option //配置

	sync.Mutex     //锁
	sync.WaitGroup //等待

	IsDebug      bool             //是否调试模式
	Tokenizer    *words.Tokenizer //分词器
	DatabaseName string           //数据库名

	Shard     int   //分片数
	Timeout   int64 //超时时间,单位秒
	BufferNum int   //分片缓冲数
	// contains filtered or unexported fields
}

func (*Engine) AddDocument

func (e *Engine) AddDocument(index *model.IndexDoc)

AddDocument 分词索引

func (*Engine) Close

func (e *Engine) Close()

func (*Engine) DocumentWorkerExec

func (e *Engine) DocumentWorkerExec(worker chan *model.IndexDoc)

DocumentWorkerExec 添加文档队列

func (*Engine) Drop

func (e *Engine) Drop() error

Drop 删除

func (*Engine) GetDocById

func (e *Engine) GetDocById(id uint32) []byte

GetDocById 通过id获取文档

func (*Engine) GetDocumentCount

func (e *Engine) GetDocumentCount() int64

GetDocumentCount 获取文档数量

func (*Engine) GetIndexCount

func (e *Engine) GetIndexCount() int64

GetIndexCount 获取索引数量

func (*Engine) GetOptions

func (e *Engine) GetOptions() *Option

func (*Engine) GetQueue

func (e *Engine) GetQueue() int

GetQueue 获取队列剩余

func (*Engine) IndexDocument

func (e *Engine) IndexDocument(doc *model.IndexDoc) error

func (*Engine) Init

func (e *Engine) Init()

Init 初始化索引引擎

func (*Engine) InitOption

func (e *Engine) InitOption(option *Option)

func (*Engine) MultiSearch

func (e *Engine) MultiSearch(request *model.SearchRequest) (*model.SearchResult, error)

MultiSearch 多线程搜索

func (*Engine) RemoveIndex

func (e *Engine) RemoveIndex(id uint32) error

RemoveIndex 根据ID移除索引

type Option

type Option struct {
	InvertedIndexName string //倒排索引
	PositiveIndexName string //正排索引
	DocIndexName      string //文档存储
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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