Documentation
¶
Index ¶
- Variables
- func CreateNewInvertedIndex(token analyzer.Tokenization, docCount int64) *types.InvertedIndexValue
- func CreateNewPostingsList(docId int64) *types.PostingsList
- func GetDbName(segId SegId) (string, string, string, string)
- func InitSegmentDb(segId SegId) (invertedDb *storage.InvertedDB, forwardDb *storage.ForwardDB, ...)
- func MergeInvertedIndex(base, toBeAdd InvertedIndexHash)
- func MergeKForwardSegments(seg *Segment, list []*TermNode, chList []chan storage.KvInfo) error
- func MergePostings(pa, pb *types.PostingsList) *types.PostingsList
- func Token2PostingsLists(bufInvertHash InvertedIndexHash, token analyzer.Tokenization, docId int64) (err error)
- type InvertedIndexHash
- type LoserTree
- type Mode
- type SegId
- type SegInfo
- type SegMeta
- type Segment
- type SkipListInt
- type SkipNodeInt
- type TermNode
Constants ¶
This section is empty.
Variables ¶
View Source
var ( TermDbSuffix = ".term" // term db suffix InvertedDbSuffix = ".inverted" // inverted db suffix ForwardDbSuffix = ".forward" // forward db suffix DictDbSuffix = ".dict" // forward db suffix )
Functions ¶
func CreateNewInvertedIndex ¶
func CreateNewInvertedIndex(token analyzer.Tokenization, docCount int64) *types.InvertedIndexValue
CreateNewInvertedIndex 创建倒排索引
func CreateNewPostingsList ¶
func CreateNewPostingsList(docId int64) *types.PostingsList
CreateNewPostingsList 创建倒排索引
func InitSegmentDb ¶
func InitSegmentDb(segId SegId) (invertedDb *storage.InvertedDB, forwardDb *storage.ForwardDB, dictDb *storage.DictDB, err error)
InitSegmentDb 读取对应segment文件下的db
func MergeInvertedIndex ¶
func MergeInvertedIndex(base, toBeAdd InvertedIndexHash)
MergeInvertedIndex 合并两个倒排索引
func MergeKForwardSegments ¶
MergeKForwardSegments 合并正排
func MergePostings ¶
func MergePostings(pa, pb *types.PostingsList) *types.PostingsList
MergePostings 合并两个posting
func Token2PostingsLists ¶
func Token2PostingsLists(bufInvertHash InvertedIndexHash, token analyzer.Tokenization, docId int64) (err error)
Token2PostingsLists 词条 转化成 倒排索引表
Types ¶
type InvertedIndexHash ¶
type InvertedIndexHash map[string]*types.InvertedIndexValue
InvertedIndexHash 倒排hash
func MergeKTermSegments ¶
func MergeKTermSegments(list []*TermNode, chList []chan storage.KvInfo) (res InvertedIndexHash, err error)
MergeKTermSegments 多路归并,合并term数据,合并后需要一起处理合并倒排表数据
type LoserTree ¶
type LoserTree struct {
// contains filtered or unexported fields
}
LoserTree 败者数
func NewSegLoserTree ¶
type SegInfo ¶
type SegInfo struct {
SegId SegId `json:"seg_name"` // 段前缀名
SegSize int64 `json:"seg_size"` // 写入doc数量
InvertedFileSize int64 `json:"inverted_file_size"` // 写入inverted文件大小
ForwardFileSize int64 `json:"forward_file_size"` // 写入forward文件大小
DictFileSize int64 `json:"dict_file_size"` // 写入forward文件大小
DelSize int64 `json:"del_size"` // 删除文档数量
DelFileSize int64 `json:"del_file_size"` // 删除文档文件大小
TermSize int64 `json:"term_size"` // term文档文件大小
TermFileSize int64 `json:"term_file_size"` // term文件大小
ReferenceCount int64 `json:"reference_count"` // 引入计数
IsReading bool `json:"is_reading"` // 是否正在被读取
IsMerging bool `json:"is_merging"` // 是否正在参与合并
}
SegInfo 段信息
type SegMeta ¶
type SegMeta struct {
NextSeg SegId `json:"next_seg"`
SegCount int64 `json:"seg_count"`
SegInfo map[SegId]*SegInfo `json:"seg_info"` // TODO replace sync.map
sync.Mutex
}
SegMeta 元数据
func (*SegMeta) NewSegmentItem ¶
type Segment ¶
type Segment struct {
*storage.ForwardDB // 正排索引库
*storage.InvertedDB // 倒排索引库
*storage.DictDB // 存储trie树
}
func NewSegment ¶
func (*Segment) FetchPostings ¶
func (e *Segment) FetchPostings(token string) (p *types.InvertedIndexValue, err error)
FetchPostings 通过 token 读取倒排表数据,返回倒排索引
func (*Segment) FlushInvertedIndex ¶ added in v0.1.0
func (e *Segment) FlushInvertedIndex(PostingsHashBuf InvertedIndexHash) (err error)
FlushInvertedIndex 落盘操作
type SkipListInt ¶
type SkipListInt struct {
SkipNodeInt
// contains filtered or unexported fields
}
func NewSkipListInt ¶
func NewSkipListInt(skip ...int) *SkipListInt
type SkipNodeInt ¶
type SkipNodeInt struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.