node

package
v0.77.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnd

func NewAnd(left, right Node) *nodeAnd

func NewNAnd

func NewNAnd(negative, regular Node) *nodeNAnd

func NewNot

func NewNot(child Node, minID, maxID LID) *nodeNot

func NewOr

func NewOr(left, right Node) *nodeOr

func NewRange

func NewRange(minVal, maxVal LID) *nodeRange

func OrMulti added in v0.77.0

func OrMulti(batches []LIDBatch, desc bool) (result LIDBatch, residuals []LIDBatch)

OrMulti unions multiple batches in the given document order and returns result and unprocessed parts for each input batch.

func TreeFold

func TreeFold[V any](op func(V, V) V, def V, values []V) V

Types

type BatchedNode added in v0.72.0

type BatchedNode interface {
	fmt.Stringer
	// NextBatch returns next batch. Returns empty batch when exhausted.
	NextBatch() LIDBatch
	// NextBatchGeq returns next batch (LIDs >= minLID). Returns empty batch when exhausted.
	NextBatchGeq(nextID LID) LIDBatch
}

func EmptyBatched added in v0.77.0

func EmptyBatched() BatchedNode

func NewAndBatched added in v0.77.0

func NewAndBatched(left, right BatchedNode, desc bool) BatchedNode

NewAndBatched returns a BatchedNode that intersects two batched iterators. desc is the document traversal order for NextBatch / NextBatchGeq.

func NewBatcherNode added in v0.77.0

func NewBatcherNode(source Node, desc bool) BatchedNode

func NewNAndBatched added in v0.77.0

func NewNAndBatched(neg, reg BatchedNode, desc bool) BatchedNode

func NewOrBatched added in v0.77.0

func NewOrBatched(left, right BatchedNode, desc bool) BatchedNode

NewOrBatched returns a BatchedNode that unions two batched iterators. desc is the document traversal order for NextBatch / NextBatchGeq.

func NewOrBatchedMulti added in v0.77.0

func NewOrBatchedMulti(children []BatchedNode, desc bool) BatchedNode

func NewStaticBatched added in v0.77.0

func NewStaticBatched(data []uint32, reverse bool) BatchedNode

type Iter added in v0.77.0

type Iter interface {
	Next() (uint32, bool)
	NextGeq(geq uint32) (uint32, bool)
}

type LID added in v0.69.0

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

LID is an encoded representation of LID and reverse flag made specifically for fast compare operations.

For reverse order LID is inverted as follows: "MaxUint32 - LID" formula using XOR mask. Terminal LID value is 0 instead of MaxUint32 in reverse order, but 0 is XORed to MaxUint32. Which means, null value will always have lid field set to 0xFFFFFFFF (math.MaxUint32) regardless of reverse (order) flag.

func Max added in v0.69.0

func Max(left, right LID) LID

func Min added in v0.69.0

func Min(left, right LID) LID

func NewAscLID added in v0.69.0

func NewAscLID(lid uint32) LID

NewAscLID returns LIDs for asc sort order

func NewAscZeroLID added in v0.72.0

func NewAscZeroLID() LID

func NewDescLID added in v0.69.0

func NewDescLID(lid uint32) LID

NewDescLID returns LIDs for desc sort order

func NewDescZeroLID added in v0.72.0

func NewDescZeroLID() LID

func NewLID added in v0.69.0

func NewLID(lid uint32, asc bool) LID

func NullLID added in v0.69.0

func NullLID() LID

func (LID) Eq added in v0.69.0

func (c LID) Eq(other LID) bool

func (LID) Inc added in v0.69.0

func (c LID) Inc() LID

func (LID) IsNull added in v0.69.0

func (c LID) IsNull() bool

func (LID) Less added in v0.69.0

func (c LID) Less(other LID) bool

Less compares two values. It also does an implicit null check, since we store math.MaxUint32 for null values. Which means if we call x.Less(y), then we know for sure that x is not null. Therefore, this Less call can work as both "null check + less" combo.

func (LID) LessOrEq added in v0.69.0

func (c LID) LessOrEq(other LID) bool

func (LID) String added in v0.69.0

func (c LID) String() string

func (LID) ToSeqLID added in v0.72.0

func (c LID) ToSeqLID() seq.LID

func (LID) Unpack added in v0.69.0

func (c LID) Unpack() uint32

type LIDBatch added in v0.72.0

type LIDBatch interface {
	Len() int
	IsEmpty() bool
	// Min returns minimum (first) value. Panics if batch is empty.
	Min() uint32
	// Max returns max (last) value. Panics if batch is empty.
	Max() uint32
	ManyIter(desc bool) ManyIter
	// Iter iterates lids in ascending way.
	Iter() Iter
	// ReverseIter iterates lids in descending way.
	ReverseIter() Iter
	// Narrow returns a batch containing only LIDs from minLID to maxLID (inclusive both).
	Narrow(minLID, maxLID uint32) LIDBatch
}

LIDBatch is batch of lids. It's immutable and can not be modified. Lids are always sorted in ascending way for every underlying implementation.

func And added in v0.77.0

func And(left, right LIDBatch, desc bool) (result, leftResidual, rightResidual LIDBatch)

And intersects two batches in the given document order and returns result and unprocessed parts (either left or right will be empty). For AND operation left and right residuals are equal to provided left or right batch, it's safe.

func AndNot added in v0.77.0

func AndNot(reg, neg LIDBatch, desc bool) (result, regResidual, negResidual LIDBatch)

AndNot finds "AND NOT" result for two batches and returns result and unprocessed parts.

func EmptyBatch added in v0.77.0

func EmptyBatch() LIDBatch

func NewBitmapBatch added in v0.77.0

func NewBitmapBatch(b *roaring.Bitmap) LIDBatch

func NewBitmapBatchFromLids added in v0.77.0

func NewBitmapBatchFromLids(lids []uint32) LIDBatch

func NewSliceBatch added in v0.77.0

func NewSliceBatch(lids []uint32) LIDBatch

func Or added in v0.77.0

func Or(left, right LIDBatch, desc bool) (result, leftResidual, rightResidual LIDBatch)

Or unions two batches in the given document order and returns result and unprocessed parts (either left or right will be empty).

type ManyIter added in v0.77.0

type ManyIter interface {
	CopyLIDs(dst []LID, tmp []uint32) int
}

type Node

type Node interface {
	fmt.Stringer // for testing
	Next() LID
	// NextGeq returns next greater or equal (GEQ) lid
	NextGeq(nextID LID) LID
}

func BuildORTree

func BuildORTree(nodes []Node) Node

func MakeStaticNodes

func MakeStaticNodes(data [][]uint32) []Node

MakeStaticNodes is currently used only for tests

func NewStatic

func NewStatic(data []uint32, reverse bool) Node

type Sourced

type Sourced interface {
	fmt.Stringer // for testing
	// aggregation need source
	NextSourced() (id LID, source uint32)
	NextSourcedGeq(nextLID LID) (id LID, source uint32)
}

func BuildORTreeAgg

func BuildORTreeAgg(nodes []Node) Sourced

func NewNodeOrAgg

func NewNodeOrAgg(left, right Sourced) Sourced

func NewSourcedNodeWrapper

func NewSourcedNodeWrapper(d Node, source int) Sourced

func WrapWithSource

func WrapWithSource(nodes []Node) []Sourced

Jump to

Keyboard shortcuts

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