negative

package
v0.0.0-...-98a29f8 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	NegativeStorage *storage.LeveldbStorage //存储负向文档的storage
	Tokenizer       *words.Tokenizer
	NegativeCount   int //负向文档数量
}
var (
	Keys []KeyItem
	Neg  *Engine
)

func NewNegative

func NewNegative(path string, tokenizer *words.Tokenizer) *Engine

func (*Engine) AllKeys

func (e *Engine) AllKeys(docs *model.NegSearch) ([]KeyItem, error)

AllKeys 函数从负向搜索的文档中获取所有关键词并返回 Engine是调用该方法的类型 docs是指向model.NegSearch的指针,表示负向搜索的文档 返回值为一个KeyItem类型的切片和error类型

func (*Engine) BatchNegativeKeys

func (e *Engine) BatchNegativeKeys(docs *[]model.NegativeDoc) ([]string, error)

BatchNegativeKeys 函数批量处理NegativeDoc类型指针切片,将其存储在NegativeStorage中,并返回存储成功的id列表和错误信息

func (*Engine) HasNegative

func (e *Engine) HasNegative(text string) ([]KeyItem, bool, error)

检测是否在关键字中

func (*Engine) NegativeKeys

func (e *Engine) NegativeKeys(doc *model.NegativeDoc) (string, error)

func (*Engine) QueryNegative

func (e *Engine) QueryNegative(s *model.NegSearch) (*model.NegResult, error)

func (*Engine) RemoveNegative

func (e *Engine) RemoveNegative(id string) error

type KeyItem

type KeyItem struct {
	Key  string
	Type string
}

Jump to

Keyboard shortcuts

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