Documentation
¶
Overview ¶
Package index defines the public vector and scalar index options, enums and metadata values used by the lance dataset package.
The types in this package describe native lance-c values. Optional tuning fields use pointers so that an explicit zero or false is forwarded instead of being replaced by a native default. A nil option means the native default.
Index ¶
- type Description
- type FileVersion
- type MergeMetadataOptions
- type MetadataFile
- type Metric
- type PrecomputedShuffleBuffers
- type PrewarmOptions
- type Progress
- type ProgressEvent
- type ProgressFunc
- type ScalarOptions
- type ScalarType
- type SegmentIndexType
- type SegmentInfo
- type SegmentListing
- type SegmentScope
- type Statistics
- type Summary
- type TrainerOptions
- type UUID
- type VectorOptions
- type VectorParams
- type VectorType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Description ¶
type Description struct {
Name string `json:"name"`
TypeURL string `json:"type_url"`
IndexType string `json:"index_type"`
Fields []int32 `json:"fields"`
FieldNames []string `json:"field_names"`
NumRowsIndexed uint64 `json:"num_rows_indexed"`
Details json.RawMessage `json:"details"`
TotalSizeBytes *uint64 `json:"total_size_bytes"`
Segments []SegmentInfo `json:"segments"`
}
Description describes one native index, including system indexes.
type FileVersion ¶
type FileVersion int32
FileVersion selects the on-disk index file format.
const ( FileVersionV3 FileVersion = 0 FileVersionLegacy FileVersion = 1 )
type MergeMetadataOptions ¶
type MergeMetadataOptions struct {
// BatchReadhead is forwarded as an explicit native batch readhead when
// non-nil, including zero. The pinned native core currently ignores it.
BatchReadhead *uint64
// Progress observes merge progress and follows the ProgressFunc contract.
Progress ProgressFunc
}
MergeMetadataOptions controls a distributed index metadata merge.
type MetadataFile ¶
MetadataFile is one index artifact recorded in segment metadata. SizeBytes is the recorded file size at segment creation time.
type PrecomputedShuffleBuffers ¶
PrecomputedShuffleBuffers selects stored shuffle buffers for distributed indexing. A non-nil value with no buffers means an explicitly empty set; nil means no precomputed shuffle buffers.
type PrewarmOptions ¶
PrewarmOptions selects index segments to prewarm. WithPosition warms FTS token positions. A nil SegmentUUIDs selects every segment; a non-nil empty slice explicitly selects none.
type Progress ¶
type Progress struct {
Event ProgressEvent
Stage string
Total uint64
Unit string
Completed uint64
}
Progress is one advisory observation from a segment build or metadata merge. Stage names are diagnostic native identifiers and may change between native releases; do not branch on them. Observations may be concurrent and unordered, so only use them for reporting.
type ProgressEvent ¶
type ProgressEvent int32
ProgressEvent identifies the lifecycle point of one progress observation. Observations for different stages may interleave and arrive from multiple threads.
const ( // ProgressStart begins a stage. Stage names the native phase, and Total and // Unit describe its extent when the native builder knows them. Total may be // zero when the extent is unknown. ProgressStart ProgressEvent = 0 // ProgressAdvance reports Completed work items of the running stage. The // native callback leaves Total and Unit empty for these events. ProgressAdvance ProgressEvent = 1 // ProgressComplete ends a stage. Every other field is zero or empty. ProgressComplete ProgressEvent = 2 )
type ProgressFunc ¶
type ProgressFunc func(Progress)
ProgressFunc observes index build progress. The native producer calls it from worker threads, possibly concurrently and for overlapping stages, so the function must be fast, thread-safe, and must not call back into any Lance API. A panic is recovered by the bridge and does not stop the build.
type ScalarOptions ¶
type ScalarOptions struct {
Train *bool
}
ScalarOptions controls scalar index behavior shared by every plugin. Family-specific keys, including RTree's page_size, are passed separately as params JSON to the dataset API's CreateScalarIndex or NewScalarSegmentBuilder.
type ScalarType ¶
type ScalarType int32
ScalarType selects a native scalar index plugin. Plugin-specific creation settings travel in the dataset API's params JSON (CreateScalarIndex and NewScalarSegmentBuilder); native code owns option validation and defaults. ScalarRTree indexes a GeoArrow geometry column and accepts page_size in that JSON. Older native libraries still load but reject ScalarRTree with a native error; the generic scalar-index ABI does not advertise which enum values are supported.
const ( ScalarBTree ScalarType = 1 ScalarBitmap ScalarType = 2 ScalarLabelList ScalarType = 3 ScalarInverted ScalarType = 4 ScalarNgram ScalarType = 5 ScalarZoneMap ScalarType = 6 ScalarBloomFilter ScalarType = 7 ScalarMinHashLSH ScalarType = 8 ScalarRTree ScalarType = 9 )
type SegmentIndexType ¶
type SegmentIndexType int32
SegmentIndexType is the native index-type discriminant recorded in segment metadata. Scalar and vector discriminants live in disjoint native ranges, so at most one of Vector and Scalar reports true.
func (SegmentIndexType) Scalar ¶
func (t SegmentIndexType) Scalar() (ScalarType, bool)
Scalar returns the scalar index type named by t and whether t is one.
func (SegmentIndexType) String ¶
func (t SegmentIndexType) String() string
String returns the native name of t, or its decimal value for a discriminant this package does not know.
func (SegmentIndexType) Vector ¶
func (t SegmentIndexType) Vector() (VectorType, bool)
Vector returns the vector index type named by t and whether t is one.
type SegmentInfo ¶
type SegmentInfo struct {
UUID string `json:"uuid"`
DatasetVersionAtLastUpdate uint64 `json:"dataset_version_at_last_update"`
FragmentIDs []uint32 `json:"fragment_ids"`
IndexVersion uint64 `json:"index_version"`
CreatedAt *string `json:"created_at"`
SizeBytes *uint64 `json:"size_bytes"`
BaseID *uint64 `json:"base_id"`
CoveringFields []int32 `json:"covering_fields"`
}
SegmentInfo describes one physical segment of a described index. A nil FragmentIDs means the recorded coverage is unknown; a non-nil empty slice means the segment is known to cover no fragments.
type SegmentListing ¶
type SegmentListing struct {
Name string `json:"name"`
UUID string `json:"uuid"`
Columns []string `json:"columns"`
Type string `json:"type"`
DatasetVersion uint64 `json:"dataset_version"`
IndexVersion uint64 `json:"index_version"`
FragmentIDs []uint32 `json:"fragment_ids"`
}
SegmentListing is one physical index segment from the native segment list. A nil FragmentIDs means unknown coverage; an empty slice means known-empty.
type SegmentScope ¶
SegmentScope selects the fragment coverage and segment identity of a new index segment. The zero value covers the whole dataset and lets the native builder generate a segment UUID.
FragmentIDs follows the same convention as SegmentInfo.FragmentIDs: nil covers the whole dataset, while a non-nil empty slice is an explicit empty coverage. UUID pins the segment identity so independently built shards can be recognized as parts of one planned index.
type Statistics ¶
type Statistics = json.RawMessage
Statistics is the native index statistics JSON. Its fields are specific to the index family, so callers decode it with json.Unmarshal. Keeping the raw bytes preserves uint64 identifiers and unknown native fields exactly.
type Summary ¶
type Summary struct {
Name string `json:"name"`
UUID string `json:"uuid"`
Columns []string `json:"columns"`
Type string `json:"type"`
DatasetVersion uint64 `json:"dataset_version"`
}
Summary is one entry from the native user index list.
type TrainerOptions ¶
TrainerOptions controls standalone IVF and PQ model training. A nil field leaves the native trainer default in place. A non-nil field is forwarded verbatim, including an explicit zero.
type UUID ¶
type UUID [16]byte
UUID is a native index segment identifier.
type VectorOptions ¶
type VectorOptions struct {
IndexType VectorType
Metric Metric
NumPartitions *uint64
TargetPartitionSize *uint64
MaxIters *uint64
SampleRate *uint64
StreamingSampleRate *uint64
StreamingCoresetRate *uint64
StreamingRefinePasses uint64
PrecomputedPartitionsFile string
PrecomputedShuffleBuffers *PrecomputedShuffleBuffers
ShufflePartitionBatches *uint64
ShufflePartitionConcurrency *uint64
StorageOptions map[string]string
NumSubVectors *uint64
NumBits *uint64
// IVFCentroids is an optional Arrow FixedSizeList array of precomputed
// centroids. PQCodebook is an optional Arrow FixedSizeList array of
// precomputed product-quantization codebooks.
IVFCentroids arrow.Array
PQCodebook arrow.Array
RabitQModelJSON json.RawMessage
HNSWMaxLevel *uint64
HNSWM *uint64
HNSWEFConstruction *uint64
FileVersion FileVersion
SkipTranspose bool
RuntimeHints map[string]string
// Train defaults to true. Set a non-nil value to choose the native train
// flag explicitly.
Train *bool
}
VectorOptions controls vector index creation. It covers every field of the native LanceVectorIndexOptions structure.
type VectorParams ¶
type VectorParams struct {
IndexType VectorType
Metric Metric
NumPartitions uint32
NumSubVectors uint32
NumBits uint32
MaxIterations uint32
HNSWM uint32
HNSWEFConstruction uint32
SampleRate uint32
}
VectorParams mirrors the legacy LanceVectorIndexParams structure. Zero values select native defaults, including native validation for required fields.
func (VectorParams) Options ¶
func (p VectorParams) Options() VectorOptions
Options expands legacy vector parameters into VectorOptions. Only non-zero legacy fields become explicit options; zero keeps the native default.
type VectorType ¶
type VectorType int32
VectorType selects a native vector index algorithm.
const ( VectorTypeIVFFlat VectorType = 101 VectorTypeIVFSQ VectorType = 102 VectorTypeIVFPQ VectorType = 103 VectorTypeIVFHNSWSQ VectorType = 104 VectorTypeIVFHNSWPQ VectorType = 105 VectorTypeIVFHNSWFlat VectorType = 106 VectorTypeIVFRQ VectorType = 107 )