fields

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseDocumentSize

func BaseDocumentSize(d *storage.Document) (size uint64)

func BaseFieldDefinitionSize

func BaseFieldDefinitionSize(f *storage.FieldDefinition) (size uint64)

Computes the base size of the struct such as the raw size and the length of pointers found Caller still requires to compute the size of the tokens in the field

func FloatField

func FloatField[T constraints.Float](dst *storage.FieldDefinition, tokPool *pool.Pool[storage.TokenDefinition], name string, v T) (size uint64)

func IntegerField

func IntegerField[T constraints.Signed](dst *storage.FieldDefinition, tokPool *pool.Pool[storage.TokenDefinition], name string, v T) (size uint64)

func KeywordField

func KeywordField(dst *storage.FieldDefinition, tokPool *pool.Pool[storage.TokenDefinition], name string, value []byte) (size uint64)

func TextField

func TextField(dst *storage.FieldDefinition, tokPool *pool.Pool[storage.TokenDefinition], name string, text []byte, tokenizer tokenizer.Tokenizer) (size uint64)

func TimeField

func TimeField(dst *storage.FieldDefinition, tokPool *pool.Pool[storage.TokenDefinition], name string, t time.Time) (size uint64)

func TokenSize

func TokenSize(t *storage.TokenDefinition) (size uint64)

Types

type Batch

type Batch struct {
	DocumentsPool *pool.Pool[storage.Document]
	// Read only field computed with each insertion
	// Size is computed from the references slices and other values present on all the documents
	// Useful as a hard limit to not grow the batch more than e.g: 5GB or so
	Size uint64
	// List of the documents already present on the batch
	Documents []*storage.Document
}

func NewBatch

func NewBatch(docsPoolSize int) (batch *Batch)

size if the size of bytes of all documents combined docs

func (*Batch) Insert

func (b *Batch) Insert(id storage.DocumentId, totalFieldsSize uint64, fields ...*storage.FieldDefinition)

Inserts a new document into the batch and updates the size of the batch

func (*Batch) Reset

func (b *Batch) Reset()

Jump to

Keyboard shortcuts

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