Documentation
¶
Index ¶
- Constants
- func DecodeMetadata(data []byte) (map[string]interface{}, error)
- func EncodeMetadata(metadata map[string]interface{}) ([]byte, error)
- func NewInvalidArgumentError(field, message string) error
- func NewNotFoundError(resource, name string) error
- func NewResourceExhaustedError(resource, message string) error
- func NewShutdownError(op, target string, err error) error
- func NewUnavailableError(operation, reason string) error
- func PackBytesToFloat32s(b []byte) []float32
- func PackLocation(loc Location) uint64
- type ArrowMetadata
- type CTE
- type Candidate
- type DistanceMetric
- type ErrInvalidArgument
- type ErrNotFound
- type ErrResourceExhausted
- type ErrUnavailable
- type FederatedSearchRequest
- type Filter
- type GeoBoundingBox
- type GeoPoint
- type GeoSearchRequest
- type Location
- type RangeSearchRequest
- type RecommendRequest
- type ResultIterator
- type ResultSliceIterator
- type SearchResult
- type TemporalAggregationRequest
- type TemporalSearchRequest
- type TemporalVersionHistoryRequest
- type TicketQuery
- type VectorID
- type VectorSearchByIDRequest
- type VectorSearchRequest
- type VectorSearchResponse
- type WindowFunction
- type WindowOrder
- type WindowSpec
Constants ¶
const ( TypeNil uint8 = 0 TypeString uint8 = 1 TypeInt64 uint8 = 2 TypeFloat64 uint8 = 3 TypeBool uint8 = 4 TypeBinary uint8 = 5 )
Metadata Type IDs
const ( SourceDense uint8 = 0 SourceSparse uint8 = 1 SourceFused uint8 = 2 )
Variables ¶
This section is empty.
Functions ¶
func DecodeMetadata ¶
DecodeMetadata deserializes binary metadata back to a map.
func EncodeMetadata ¶
EncodeMetadata serializes a map to a compact binary format.
func NewInvalidArgumentError ¶
func NewNotFoundError ¶
NewNotFoundError creates a not found error.
func NewShutdownError ¶
NewShutdownError creates a formatted error for shutdown failures.
func NewUnavailableError ¶
func PackBytesToFloat32s ¶
Uint32FromFloat32 bits helper (commonly used in packing)
func PackLocation ¶
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 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 ¶
ErrInvalidArgument indicates invalid input.
func (*ErrInvalidArgument) Error ¶
func (e *ErrInvalidArgument) Error() string
type ErrNotFound ¶
ErrNotFound indicates a requested resource does not exist.
func (*ErrNotFound) Error ¶
func (e *ErrNotFound) Error() string
type ErrResourceExhausted ¶
ErrResourceExhausted indicates system resource limits exceeded.
func (*ErrResourceExhausted) Error ¶
func (e *ErrResourceExhausted) Error() string
type ErrUnavailable ¶
type ErrUnavailable struct {
}
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 (*GeoPoint) UnmarshalJSON ¶
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 ¶
Location maps a VectorID to a physical location in a Dataset (Batch + Row).
func UnpackLocation ¶
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 ¶
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