search

package
v0.0.0-...-7723c0b Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type FieldMeta

type FieldMeta struct {
	Name string    //字段名称
	Type FieldType //类型
}

type FieldType

type FieldType byte
const (
	FT_TEXT   FieldType = 11 //文本类型
	FT_NUMBER FieldType = 9  //数字
	FT_ENUM   FieldType = 8  //枚举
	FT_ID     FieldType = 7  //id唯一标识
	FT_DATE   FieldType = 6  //日期
)

type IndexMeta

type IndexMeta struct {
	Name   string      //索引名称
	Fields []FieldMeta //字段
}

索引的元数据信息

type PageSearchResult

type PageSearchResult struct {
	Id    string `json:"uuid"` //查询的请求id
	Index int64  `json:"page"` //页码
	Data  []TargetObject
}

type SearchEngine

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

func (*SearchEngine) BeginSafeFlush

func (this *SearchEngine) BeginSafeFlush(name string)

开始安全flush

func (*SearchEngine) CreateIndex

func (this *SearchEngine) CreateIndex(name string) *searchIndex

创建索引

func (*SearchEngine) EndSafeFlush

func (this *SearchEngine) EndSafeFlush(name string)

结束安全flush,自动替换掉查询用的索引

func (*SearchEngine) Fetch

func (this *SearchEngine) Fetch(name, id string) *SourceObject

func (*SearchEngine) FetchByPage

func (this *SearchEngine) FetchByPage(request string, page int64) *PageSearchResult

按页获取数据

func (*SearchEngine) FlushIndex

func (this *SearchEngine) FlushIndex(name string)

清除索引,将整个索引的数据摧毁

func (*SearchEngine) Init

func (this *SearchEngine) Init(context *bingo.ApplicationContext)

func (*SearchEngine) LoadSource

func (this *SearchEngine) LoadSource(name string, obj *SourceObject)

加载和刷新数据

func (*SearchEngine) RemoveBySearch

func (this *SearchEngine) RemoveBySearch(name string, input ...Field)

根据查询条件删除数据,只支持单个条件很正向条件的索引字段删除,数据删除支持搜索删除

func (*SearchEngine) RemoveKeyword

func (this *SearchEngine) RemoveKeyword(name, field, word string)

删除索引中的某个词条

func (*SearchEngine) RemoveSource

func (this *SearchEngine) RemoveSource(name string, obj *SourceObject)

删除数据

func (*SearchEngine) Search

func (this *SearchEngine) Search(name string, input ...Field) *PageSearchResult

type SourceObject

type SourceObject struct {
	TargetObject
	Fields map[string][]string `json:"fields"`
}

type TargetObject

type TargetObject struct {
	Id   string          `json:"id"`
	Data json.RawMessage `json:"data"`
}

Jump to

Keyboard shortcuts

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