segment

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrClosed = fmt.Errorf("index closed")

Functions

This section is empty.

Types

type Automaton

type Automaton interface {
	// Start returns the start state.
	Start() int

	// IsMatch returns true if and only if the state is a match.
	IsMatch(int) bool

	// CanMatch returns true if and only if it is possible to reach a match
	// in zero or more steps.
	CanMatch(int) bool

	// WillAlwaysMatch returns true if and only if the current state matches
	// and will always match no matter what steps are taken.
	WillAlwaysMatch(int) bool

	// Accept returns the next state given the input to the specified state.
	Accept(int, byte) int
}

type CollectionStats

type CollectionStats interface {
	TotalDocumentCount() uint64
	DocumentCount() uint64
	SumTotalTermFrequency() uint64
	Merge(CollectionStats)
}

type Data

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

Data is an opaque representation of data backed by memory or a ReaderAt.

func NewDataBytes

func NewDataBytes(b []byte) *Data

func NewDataFile

func NewDataFile(f *os.File) (*Data, error)

func (*Data) Len

func (d *Data) Len() int

func (*Data) Read

func (d *Data) Read(start, end int) ([]byte, error)

func (*Data) Reader

func (d *Data) Reader() *DataReader

func (*Data) Size

func (d *Data) Size() int

func (*Data) Slice

func (d *Data) Slice(start, end int) *Data

func (*Data) WriteTo

func (d *Data) WriteTo(w io.Writer) (int64, error)

type DataReader

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

func (*DataReader) Read

func (r *DataReader) Read(p []byte) (n int, err error)

type Dictionary

type Dictionary interface {
	DictionaryLookup
	PostingsList(term []byte, except *roaring.Bitmap, prealloc PostingsList) (PostingsList, error)
	Iterator(a Automaton, startKeyInclusive, endKeyExclusive []byte) DictionaryIterator
}

type DictionaryEntry

type DictionaryEntry interface {
	Term() string
	Count() uint64
}

type DictionaryIterator

type DictionaryIterator interface {
	Next() (DictionaryEntry, error)
	Close() error
}

type DictionaryLookup

type DictionaryLookup interface {
	Contains(key []byte) (bool, error)
	Close() error
}

type DocVisitState

type DocVisitState interface{}

type Document

type Document interface {
	Analyze()
	EachField(vf VisitField)
}

type DocumentValueReader

type DocumentValueReader interface {
	VisitDocumentValues(number uint64, visitor DocumentValueVisitor) error
}

type DocumentValueVisitor

type DocumentValueVisitor func(field string, term []byte)

type Field

type Field interface {
	Name() string
	Length() int
	EachTerm(vt VisitTerm)
	Value() []byte

	Index() bool
	Store() bool
	IndexDocValues() bool
}

type FieldTerm

type FieldTerm interface {
	Term() []byte
	Frequency() int
	EachLocation(vl VisitLocation)
}

type Impact

type Impact struct {
	Frequency uint64
	Norm      uint64
}

Impact is one non-dominated frequency and raw-norm pair from a postings block. Scorers use the pairs to compute an exact upper bound for the block.

type ImpactPostingsIterator

type ImpactPostingsIterator interface {
	HasImpacts() bool
	AdvanceShallow(docNum uint64) (blockEnd uint64, impacts []Impact, ok bool, err error)
}

ImpactPostingsIterator is optionally implemented by postings iterators that carry block-level impacts. AdvanceShallow moves only the impact cursor and returns the inclusive end document for the block containing docNum.

type Location

type Location interface {
	Field() string
	Start() int
	End() int
	Pos() int
	Size() int
}

type Merger

type Merger interface {
	WriteTo(w io.Writer, closeCh chan struct{}) (n int64, err error)
	DocumentNumbers() [][]uint64
}

type Optimizable

type Optimizable interface {
	Optimize(kind string, octx OptimizableContext) (OptimizableContext, error)
}

type OptimizableContext

type OptimizableContext interface {
	Finish() (PostingsIterator, error)
}

type OptimizablePostingsIterator

type OptimizablePostingsIterator interface {
	ActualBitmap() *roaring.Bitmap
	DocNum1Hit() (uint64, bool)
	ReplaceActual(*roaring.Bitmap)
}

type Posting

type Posting interface {
	Number() uint64
	SetNumber(uint64)
	Frequency() int
	Norm() float64
	Locations() []Location
	Size() int
}

type PostingsIterator

type PostingsIterator interface {
	Next() (Posting, error)
	Advance(docNum uint64) (Posting, error)
	Size() int
	Empty() bool
	Count() uint64
	Close() error
}

type PostingsList

type PostingsList interface {
	Iterator(includeFreq, includeNorm, includeLocations bool, prealloc PostingsIterator) (PostingsIterator, error)
	Size() int
	Count() uint64
}

type Segment

type Segment interface {
	Dictionary(field string) (Dictionary, error)
	VisitStoredFields(num uint64, visitor StoredFieldVisitor) error
	Count() uint64
	DocsMatchingTerms([]Term) (*roaring.Bitmap, error)
	Fields() []string
	CollectionStats(field string) (CollectionStats, error)
	Size() int
	DocumentValueReader(fields []string) (DocumentValueReader, error)
	WriteTo(w io.Writer, closeCh chan struct{}) (int64, error)
	Type() string
	Version() uint32
}

type StoredFieldVisitor

type StoredFieldVisitor func(field string, value []byte) bool

type Term

type Term interface {
	Field() string
	Term() []byte
}

type TermStats

type TermStats interface {
	DocumentFrequency() uint64
}

type VisitField

type VisitField func(Field)

type VisitLocation

type VisitLocation func(Location)

type VisitTerm

type VisitTerm func(FieldTerm)

Jump to

Keyboard shortcuts

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