core

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Unlicense Imports: 8 Imported by: 0 modules, 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

View Source
const (
	TypeNil     uint8 = 0
	TypeString  uint8 = 1
	TypeInt64   uint8 = 2
	TypeFloat64 uint8 = 3
	TypeBool    uint8 = 4
	TypeBinary  uint8 = 5
)

Metadata Type IDs

View Source
const (
	SourceDense  uint8 = 0
	SourceSparse uint8 = 1
	SourceFused  uint8 = 2
)

Variables

This section is empty.

Functions

func DecodeMetadata

func DecodeMetadata(data []byte) (map[string]interface{}, error)

DecodeMetadata deserializes binary metadata back to a map.

func EncodeMetadata

func EncodeMetadata(metadata map[string]interface{}) ([]byte, error)

EncodeMetadata serializes a map to a compact binary format.

func NewInvalidArgumentError

func NewInvalidArgumentError(field, message string) error

func NewNotFoundError

func NewNotFoundError(resource, name string) error

NewNotFoundError creates a not found error.

func NewResourceExhaustedError

func NewResourceExhaustedError(resource, message string) error

func NewShutdownError

func NewShutdownError(op, target string, err error) error

NewShutdownError creates a formatted error for shutdown failures.

func NewUnavailableError

func NewUnavailableError(operation, reason string) error

func PackBytesToFloat32s

func PackBytesToFloat32s(b []byte) []float32

Uint32FromFloat32 bits helper (commonly used in packing)

func PackLocation

func PackLocation(loc Location) uint64

PackLocation packs a Location into a uint64 for atomic storage. It assumes batchIdx and rowIdx fit within 32 bits, which is generally safe. This matches the logic previously in internal/store/location_store.go

Types

type ArrowMetadata

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

func NewArrowMetadata

func NewArrowMetadata(data []byte) ArrowMetadata

func (ArrowMetadata) GetField

func (m ArrowMetadata) GetField(key string) (interface{}, bool)

GetField extracts a field value without allocating a map.

func (ArrowMetadata) ToMap

func (m ArrowMetadata) ToMap() (map[string]interface{}, error)

ToMap converts to the legacy format if needed (for backward compatibility)

type CTE

type CTE struct {
	Name    string               `json:"name"`
	Search  *VectorSearchRequest `json:"search"`
	Columns []string             `json:"columns,omitempty"`
}

CTE defines a Common Table Expression

type Candidate

type Candidate struct {
	ID    uint32
	Dist  float32
	Level int // for hierarchical structures
}

Candidate represents a search result candidate with ID and distance

type DistanceMetric

type DistanceMetric string

DistanceMetric defines the distance metric used for vector comparison.

const (
	// MetricEuclidean is the default L2 distance (lower is closer).
	MetricEuclidean DistanceMetric = "euclidean"
	// MetricCosine is the Cosine distance (1.0 - cosine_similarity).
	MetricCosine DistanceMetric = "cosine"
	// MetricDotProduct is the Inner Product (higher is usually better, but handling depends mostly on impl).
	MetricDotProduct DistanceMetric = "dot_product"
	// MetricL2Squared is the squared Euclidean distance (L2^2).
	MetricL2Squared DistanceMetric = "l2_squared"
)

type ErrInvalidArgument

type ErrInvalidArgument struct {
	Field   string
	Message string
}

ErrInvalidArgument indicates invalid input.

func (*ErrInvalidArgument) Error

func (e *ErrInvalidArgument) Error() string

type ErrNotFound

type ErrNotFound struct {
	Resource string
	Name     string
}

ErrNotFound indicates a requested resource does not exist.

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

type ErrResourceExhausted

type ErrResourceExhausted struct {
	Resource string
	Message  string
}

ErrResourceExhausted indicates system resource limits exceeded.

func (*ErrResourceExhausted) Error

func (e *ErrResourceExhausted) Error() string

type ErrUnavailable

type ErrUnavailable struct {
	Operation string
	Reason    string
}

ErrUnavailable indicates temporary unavailability.

func (*ErrUnavailable) Error

func (e *ErrUnavailable) Error() string

type FederatedSearchRequest

type FederatedSearchRequest struct {
	Collections []string  `json:"collections,omitempty"`
	Tags        []string  `json:"tags,omitempty"`
	Vector      []float32 `json:"vector"`
	K           int       `json:"k"`
	RRFK        int       `json:"rrf_k,omitempty"`
}

FederatedSearchRequest represents a federated cross-collection vector search query.

type Filter

type Filter struct {
	Field    string `json:"field,omitempty"`
	Operator string `json:"operator,omitempty"`
	Value    string `json:"value,omitempty"`
	// Logic combines multiple filters: "AND", "OR", "NOT"
	Logic   string   `json:"logic,omitempty"`
	Filters []Filter `json:"filters,omitempty"`
	// Subquery allows filtering based on the results of another query
	Subquery *TicketQuery `json:"subquery,omitempty"`
	// ResolvedValues stores the results of a subquery after it's executed
	ResolvedValues []any `json:"-"`
}

Filter defines a filter for search results

type GeoBoundingBox

type GeoBoundingBox struct {
	MinLat float64 `json:"min_lat"`
	MaxLat float64 `json:"max_lat"`
	MinLon float64 `json:"min_lon"`
	MaxLon float64 `json:"max_lon"`
}

GeoBoundingBox represents a rectangular geographic area

type GeoPoint

type GeoPoint struct {
	Lat  float64 `json:"lat"`
	Lon  float64 `json:"lon"`
	Name string  `json:"name,omitempty"`
}

GeoPoint represents a coordinate on Earth

func (*GeoPoint) MarshalJSON

func (g *GeoPoint) MarshalJSON() ([]byte, error)

func (*GeoPoint) UnmarshalJSON

func (g *GeoPoint) UnmarshalJSON(data []byte) error

type GeoSearchRequest

type GeoSearchRequest struct {
	Dataset     string          `json:"dataset"`
	Center      GeoPoint        `json:"center"`
	RadiusKm    float64         `json:"radius_km"`
	Box         *GeoBoundingBox `json:"box,omitempty"`
	K           int             `json:"k"`
	Filters     []Filter        `json:"filters,omitempty"`
	SearchType  string          `json:"search_type"` // "radius", "box", "hybrid"
	QueryVector []float32       `json:"query_vector,omitempty"`
}

GeoSearchRequest defines the request format for Geospatial search

type Location

type Location struct {
	BatchIdx int
	RowIdx   int
}

Location maps a VectorID to a physical location in a Dataset (Batch + Row).

func UnpackLocation

func UnpackLocation(val uint64) Location

UnpackLocation unpacks a uint64 into a Location.

type RangeSearchRequest

type RangeSearchRequest struct {
	Dataset    string    `json:"dataset"`
	Vector     []float32 `json:"vector"`
	Threshold  float32   `json:"threshold"`
	Filters    []Filter  `json:"filters,omitempty"`
	MaxResults int       `json:"max_results,omitempty"`
}

RangeSearchRequest represents a distance-threshold range search query.

type RecommendRequest

type RecommendRequest struct {
	Dataset string   `json:"dataset"`
	SeedIDs []string `json:"seed_ids"`
	K       int      `json:"k"`
	Alpha   float32  `json:"alpha"`
	MaxHops int      `json:"max_hops,omitempty"`
	Decay   float32  `json:"decay,omitempty"`
}

RecommendRequest defines the request for recommendation

type ResultIterator

type ResultIterator interface {
	// Next returns the next search result. Returns (SearchResult{}, false) if no more results.
	Next() (SearchResult, bool)
	// Close releases any resources held by the iterator.
	Close() error
}

ResultIterator provides a streaming interface for search results.

type ResultSliceIterator

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

ResultSliceIterator implements ResultIterator for a simple slice of results.

func NewResultSliceIterator

func NewResultSliceIterator(results []SearchResult) *ResultSliceIterator

func (*ResultSliceIterator) Close

func (it *ResultSliceIterator) Close() error

func (*ResultSliceIterator) Next

func (it *ResultSliceIterator) Next() (SearchResult, bool)

type SearchResult

type SearchResult struct {
	ID       VectorID
	Distance float32
	Score    float32
	Metadata []byte // Binary metadata payload (zero-copy optimized)
	Vector   []byte // Binary payload for the vector if requested
	Source   uint8  // 0=Dense, 1=Sparse, 2=Fused (see constants)
}

SearchResult represents a single flight search result

type TemporalAggregationRequest

type TemporalAggregationRequest struct {
	Dataset         string `json:"dataset"`
	AggregationType string `json:"aggregation_type"` // count, min, max, mean, sum
	StartTime       int64  `json:"start_time"`
	EndTime         int64  `json:"end_time"`
	Interval        int64  `json:"interval"` // bucket interval in nanoseconds
	MetricField     string `json:"metric_field,omitempty"`
}

TemporalAggregationRequest defines analytical temporal query

func (*TemporalAggregationRequest) Validate

func (req *TemporalAggregationRequest) Validate() error

type TemporalSearchRequest

type TemporalSearchRequest struct {
	Dataset    string        `json:"dataset"`
	SearchType string        `json:"search_type"` // "as_of", "range", "sliding_window", "sliding_window_time"
	K          int           `json:"k"`
	Timestamp  int64         `json:"timestamp,omitempty"`
	StartTime  int64         `json:"start_time,omitempty"`
	EndTime    int64         `json:"end_time,omitempty"`
	WindowSize int           `json:"window_size,omitempty"`
	Duration   time.Duration `json:"duration,omitempty"`
	Filters    []Filter      `json:"filters,omitempty"`
}

TemporalSearchRequest defines the request format for temporal queries

func (*TemporalSearchRequest) Validate

func (req *TemporalSearchRequest) Validate() error

type TemporalVersionHistoryRequest

type TemporalVersionHistoryRequest struct {
	Dataset  string `json:"dataset"`
	VectorID uint64 `json:"vector_id"`
}

TemporalVersionHistoryRequest defines request for version history

type TicketQuery

type TicketQuery struct {
	Name            string                   `json:"name"`
	Limit           int64                    `json:"limit"`
	Filters         []Filter                 `json:"filters"`
	WindowFunctions []WindowFunction         `json:"window_functions,omitempty"`
	Search          *VectorSearchRequest     `json:"search,omitempty"`
	SearchByID      *VectorSearchByIDRequest `json:"search_by_id,omitempty"`
	Recommend       *RecommendRequest        `json:"recommend,omitempty"`
	GeoSearch       *GeoSearchRequest        `json:"geo_search,omitempty"`
	TemporalSearch  *TemporalSearchRequest   `json:"temporal_search,omitempty"`
	RangeSearch     *RangeSearchRequest      `json:"range_search,omitempty"`
	FederatedSearch *FederatedSearchRequest  `json:"federated_search,omitempty"`
	CTEs            []CTE                    `json:"ctes,omitempty"`
	Mode            string                   `json:"mode,omitempty"` // search mode: dense, sparse, filtered, hybrid, range, federated

	// Backwards compatibility / Direct shortcut fields
	Vector []float32 `json:"vector,omitempty"`
	K      int       `json:"k,omitempty"`
}

TicketQuery defines the structure for a ticket based query

type VectorID

type VectorID uint32

VectorID is a unique identifier for a vector in the system. It is physically a uint32, allowing for ~4 billion vectors per shard.

type VectorSearchByIDRequest

type VectorSearchByIDRequest struct {
	Dataset        string `json:"dataset"`
	ID             string `json:"id"`
	K              int    `json:"k"`
	IncludeVectors bool   `json:"include_vectors,omitempty"`
	VectorFormat   string `json:"vector_format,omitempty"`
	VectorType     string `json:"vector_type,omitempty"`
	TurboQuantBits int    `json:"turboquant_bits,omitempty"`
}

VectorSearchByIDRequest defines the request format for searching by User ID

type VectorSearchRequest

type VectorSearchRequest struct {
	Dataset            string                 `json:"dataset"`
	Vector             []float32              `json:"vector,omitempty"`
	Vectors            [][]float32            `json:"vectors,omitempty"`
	K                  int                    `json:"k"`
	Filters            []Filter               `json:"filters,omitempty"`
	FilterExpr         map[string]interface{} `json:"filter_expr,omitempty"`
	LocalOnly          bool                   `json:"local_only,omitempty"`
	TextQuery          string                 `json:"text_query,omitempty"`
	Alpha              float32                `json:"alpha,omitempty"`
	GraphAlpha         float32                `json:"graph_alpha,omitempty"`
	GraphDepth         int                    `json:"graph_depth,omitempty"`
	IncludeVectors     bool                   `json:"include_vectors,omitempty"`
	VectorFormat       string                 `json:"vector_format,omitempty"`
	VectorType         string                 `json:"vector_type,omitempty"`     // "float32", "turboquant", etc.
	TurboQuantBits     int                    `json:"turboquant_bits,omitempty"` // 4, 8 bits
	Consistency        string                 `json:"consistency,omitempty"`     // "ONE", "QUORUM", "ALL"
	EfSearch           int                    `json:"ef_search,omitempty"`
	EnableLearnedIndex bool                   `json:"enable_learned_index,omitempty"`
	WindowFunctions    []WindowFunction       `json:"window_functions,omitempty"`
	RawHybrid          bool                   `json:"raw_hybrid,omitempty"` // If true, returns un-fused dense and sparse results
}

VectorSearchRequest defines the request format for VectorSearch action

type VectorSearchResponse

type VectorSearchResponse struct {
	IDs    []uint64  `json:"ids"`
	Scores []float32 `json:"scores"`
}

VectorSearchResponse defines the response format for VectorSearch action

type WindowFunction

type WindowFunction struct {
	Name  string     `json:"name"`            // row_number, rank, dense_rank
	Field string     `json:"field,omitempty"` // Field to aggregate (for avg, sum, etc.)
	Over  WindowSpec `json:"over"`
	As    string     `json:"as"` // Output column name
}

WindowFunction defines an analytical function to be applied over result sets

type WindowOrder

type WindowOrder struct {
	Field      string `json:"field"`
	Descending bool   `json:"descending,omitempty"`
}

WindowOrder defines Sort order within a window

type WindowSpec

type WindowSpec struct {
	PartitionBy []string      `json:"partition_by,omitempty"`
	OrderBy     []WindowOrder `json:"order_by,omitempty"`
}

WindowSpec defines the partition and ordering for a window function

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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