index

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveMeta

func SaveMeta(meta *IndexMeta, dir directory.Directory) error

func SeekDocSet

func SeekDocSet(docSet DocSet, target schema.DocID) schema.DocID

Types

type Builder

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

func NewBuilder

func NewBuilder(indexSchema *schema.Schema) *Builder

func (*Builder) CreateInDir

func (b *Builder) CreateInDir(path string) (*Index, error)

func (*Builder) OpenOrCreate

func (b *Builder) OpenOrCreate(path string) (*Index, error)

type DeleteMeta

type DeleteMeta struct {
	NumDeletedDocs uint32          `json:"numDeletedDocs"`
	Opstamp        opstamp.OpStamp `json:"operationId"`
}

type DocAddress

type DocAddress struct {
	SegmentOrd int
	DocID      schema.DocID
}

type DocSet

type DocSet interface {
	Advance() schema.DocID
	Doc() schema.DocID
	Seek(target schema.DocID) schema.DocID
	SizeHint() uint32
}

type Document

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

type Index

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

func NewIndexFromMeta

func NewIndexFromMeta(directory directory.Directory, meta *IndexMeta, inventory *SegmentMetaInventory) *Index

func OpenIndex

func OpenIndex(dir directory.Directory) (*Index, error)

func (*Index) Directory

func (i *Index) Directory() directory.Directory

func (*Index) LoadMeta

func (i *Index) LoadMeta() (*IndexMeta, error)

func (*Index) NewSegment

func (i *Index) NewSegment() *Segment

func (*Index) NewSegmentMeta

func (i *Index) NewSegmentMeta(segmentID SegmentID, maxDoc schema.DocID) *SegmentMeta

func (*Index) Schema

func (i *Index) Schema() *schema.Schema

func (*Index) SearchableSegments

func (i *Index) SearchableSegments() ([]*Segment, error)

func (*Index) Segment

func (i *Index) Segment(segmentMeta *SegmentMeta) *Segment

type IndexMeta

type IndexMeta struct {
	Segments []*SegmentMeta `json:"segments"`
	Schema   *schema.Schema `json:"schema"`
	// last commit operation's id
	Opstamp opstamp.OpStamp `json:"opstamp"`
}

func LoadMeta

func LoadMeta(directory directory.Directory, inventory *SegmentMetaInventory) (*IndexMeta, error)

func NewIndexMeta

func NewIndexMeta(schema *schema.Schema) *IndexMeta

type Segment

type Segment struct {
	Index *Index
	// contains filtered or unexported fields
}

func (*Segment) Meta

func (s *Segment) Meta() *SegmentMeta

func (*Segment) OpenRead

func (s *Segment) OpenRead(component SegmentComponent) (*directory.FileSlice, error)

func (*Segment) OpenWrite

func (s *Segment) OpenWrite(component SegmentComponent) (directory.WriteCloseSyncer, error)

func (*Segment) Schema

func (s *Segment) Schema() *schema.Schema

func (*Segment) WithMaxDoc

func (s *Segment) WithMaxDoc(maxDoc schema.DocID) *Segment

type SegmentComponent

type SegmentComponent int
const (
	SegmentComponentPostings SegmentComponent = iota + 1
	SegmentComponentTerms
	SegmentComponentStore
	SegmentComponentDelete
)

type SegmentID

type SegmentID string

func NewSegmentID

func NewSegmentID() SegmentID

type SegmentMeta

type SegmentMeta struct {
	SegmentID SegmentID    `json:"segmentId"`
	MaxDoc    schema.DocID `json:"maxDoc"`
	Deletes   *DeleteMeta  `json:"deletes"`
}

func (*SegmentMeta) DocNum

func (s *SegmentMeta) DocNum() uint32

func (*SegmentMeta) RelativePath

func (s *SegmentMeta) RelativePath(component SegmentComponent) string

func (*SegmentMeta) WithMaxDoc

func (s *SegmentMeta) WithMaxDoc(maxDoc schema.DocID) *SegmentMeta

type SegmentMetaInventory

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

func (*SegmentMetaInventory) NewSegmentMeta

func (i *SegmentMetaInventory) NewSegmentMeta(segmentID SegmentID, maxDoc schema.DocID) *SegmentMeta

Jump to

Keyboard shortcuts

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