Documentation
¶
Index ¶
- func AddOwnership(objs []*Object, node, shard string)
- func DocIDAndTimeFromBinary(in []byte) (uint64, int64, error)
- func DocIDFromBinary(in []byte) (uint64, error)
- func MultiVectorFromBinary(in []byte, buffer []float32, targetVector string) ([][]float32, error)
- func NewErrNotFoundf(docID uint64, msg string, args ...interface{}) error
- func ParseAndExtractBoolArrayProp(data []byte, propName string) ([]bool, bool, error)
- func ParseAndExtractNumberArrayProp(data []byte, propName string) ([]float64, bool, error)
- func ParseAndExtractProperty(data []byte, propName string) ([]string, bool, error)
- func ParseAndExtractTextProp(data []byte, propName string) ([]string, bool, error)
- func SearchResults(in []*Object, additional additional.Properties, tenant string) search.Results
- func SearchResultsWithDists(in []*Object, addl additional.Properties, dists []float32) search.Results
- func SearchResultsWithScore(in []*Object, scores []float32, additional additional.Properties, ...) search.Results
- func UnmarshalProperties(data []byte, properties map[string]interface{}, propertyPaths [][]string) error
- func UnmarshalPropertiesFromObject(data []byte, resultProperties map[string]interface{}, propertyPaths [][]string) error
- func VectorFromBinary(in []byte, buffer []float32, targetVector string) ([]float32, error)
- type ErrNotFound
- type ErrTargetVectorNotFound
- type ExportFields
- type Object
- func FromBinaryDisk(data []byte, className string) (*Object, error)
- func FromBinaryNetwork(data []byte) (*Object, error)
- func FromBinaryOptionalDisk(data []byte, className string, addProp additional.Properties, ...) (*Object, error)
- func FromBinaryOptionalNetwork(data []byte, addProp additional.Properties, properties *PropertyExtraction) (*Object, error)
- func FromBinaryUUIDOnlyDisk(data []byte, className string) (*Object, error)
- func FromObject(object *models.Object, vector []float32, vectors map[string][]float32, ...) *Object
- func New(docID uint64) *Object
- func ObjectsByDocID(bucket bucket, ids []uint64, additional additional.Properties, ...) ([]*Object, error)
- func ObjectsByDocIDWithEmpty(bucket bucket, ids []uint64, additional additional.Properties, ...) ([]*Object, error)
- func (ko *Object) AdditionalProperties() models.AdditionalProperties
- func (ko *Object) Class() schema.ClassName
- func (ko *Object) CreationTimeUnix() int64
- func (ko *Object) DeepCopyDangerous() *Object
- func (ko *Object) ExplainScore() string
- func (ko *Object) GetDocID() uint64
- func (ko *Object) GetVectors() models.Vectors
- func (ko *Object) ID() strfmt.UUID
- func (ko *Object) IterateThroughVectorDimensions(f func(targetVector string, dims int) error) error
- func (ko *Object) LastUpdateTimeUnix() int64
- func (ko *Object) MarshalBinary() ([]byte, error)
- func (ko *Object) MarshalBinaryOptional(addProps additional.Properties) ([]byte, error)
- func (ko *Object) Properties() models.PropertySchema
- func (ko *Object) PropertiesWithAdditional(additional additional.Properties) models.PropertySchema
- func (ko *Object) SearchResult(additional additional.Properties, tenant string) *search.Result
- func (ko *Object) SearchResultWithDist(addl additional.Properties, dist float32) search.Result
- func (ko *Object) SearchResultWithScore(addl additional.Properties, score float32) search.Result
- func (ko *Object) SearchResultWithScoreAndTenant(addl additional.Properties, score float32, tenant string) search.Result
- func (ko *Object) SetClass(class string)
- func (ko *Object) SetDocID(id uint64)
- func (ko *Object) SetID(id strfmt.UUID)
- func (ko *Object) SetProperties(schema models.PropertySchema)
- func (ko *Object) UnmarshalBinaryDisk(data []byte, className string) error
- func (ko *Object) UnmarshalBinaryNetwork(data []byte) error
- func (ko *Object) Valid() bool
- func (ko *Object) VectorWeights() models.VectorWeights
- type PropertyExtraction
- type Vectors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOwnership ¶ added in v1.19.0
func DocIDAndTimeFromBinary ¶ added in v1.26.0
func DocIDFromBinary ¶
func MultiVectorFromBinary ¶ added in v1.29.0
func NewErrNotFoundf ¶
func ParseAndExtractBoolArrayProp ¶ added in v1.21.2
func ParseAndExtractProperty ¶
func ParseAndExtractTextProp ¶
func SearchResults ¶
func SearchResults(in []*Object, additional additional.Properties, tenant string) search.Results
func SearchResultsWithDists ¶
func SearchResultsWithDists(in []*Object, addl additional.Properties, dists []float32, ) search.Results
func SearchResultsWithScore ¶ added in v1.24.5
func SearchResultsWithScore(in []*Object, scores []float32, additional additional.Properties, tenant string) search.Results
func UnmarshalProperties ¶ added in v1.27.0
func UnmarshalProperties(data []byte, properties map[string]interface{}, propertyPaths [][]string) error
UnmarshalProperties accepts serialized properties as data and populates resultProperties map with the properties specified by propertyPaths.
func UnmarshalPropertiesFromObject ¶
func UnmarshalPropertiesFromObject(data []byte, resultProperties map[string]interface{}, propertyPaths [][]string) error
UnmarshalPropertiesFromObject accepts marshaled object as data and populates resultProperties map with the properties specified by propertyPaths.
Check MarshalBinary for the order of elements in the input array
Types ¶
type ErrNotFound ¶
func (ErrNotFound) Error ¶
func (err ErrNotFound) Error() string
type ErrTargetVectorNotFound ¶ added in v1.34.20
type ErrTargetVectorNotFound struct {
TargetVector string
}
func (ErrTargetVectorNotFound) Error ¶ added in v1.34.20
func (err ErrTargetVectorNotFound) Error() string
type ExportFields ¶ added in v1.37.0
type ExportFields struct {
ID string
CreateTime int64
UpdateTime int64
VectorBytes []byte // raw LE float32 bytes, nil if no vector
Properties []byte // raw JSON bytes as originally stored, nil if no properties
NamedVectors []byte // JSON-encoded named vectors, nil if none
MultiVectors []byte // JSON-encoded multi-vectors, nil if none
}
ExportFields contains export-ready data extracted directly from the binary storage format. This avoids the full *Object deserialization round-trip (json.Unmarshal + enrichSchemaTypes + json.Marshal) that is unnecessary when the goal is to produce Parquet export rows.
func ExportFieldsFromBinary ¶ added in v1.37.0
func ExportFieldsFromBinary(data []byte) (ExportFields, error)
ExportFieldsFromBinary extracts export-ready fields directly from the binary storage format without constructing a full *Object. This skips:
- json.Unmarshal / json.Marshal of properties (biggest win)
- enrichSchemaTypes (lossy type conversions not needed for export)
- []float32 allocation for primary/named/multi vectors
- models.Object construction overhead
type Object ¶
type Object struct {
MarshallerVersion uint8
Object models.Object `json:"object"`
Vector []float32 `json:"vector"`
VectorLen int `json:"-"`
BelongsToNode string `json:"-"`
BelongsToShard string `json:"-"`
IsConsistent bool `json:"-"`
DocID uint64
Vectors map[string][]float32 `json:"vectors"`
MultiVectors map[string][][]float32 `json:"multivectors"`
}
func FromBinaryDisk ¶ added in v1.37.3
FromBinaryDisk decodes a payload and stamps the caller-supplied class name on the decoded object, ignoring whatever is in the on-disk class-name field. className must be non-empty; the function returns an error otherwise. Use FromBinaryNetwork for the on-disk-fallback path used by wire-receive callers that have no canonical class to supply.
func FromBinaryNetwork ¶ added in v1.37.3
FromBinaryNetwork decodes a payload and reads Object.Class from the data bytes. Network methods are used for node to node communication. Use FromBinaryDisk when reading from disk, as the on-disk class-name may be empty.
func FromBinaryOptionalDisk ¶ added in v1.37.3
func FromBinaryOptionalDisk(data []byte, className string, addProp additional.Properties, properties *PropertyExtraction, ) (*Object, error)
FromBinaryOptionalDisk lets the caller supply an authoritative class name; an empty className falls back to the on-disk bytes.
func FromBinaryOptionalNetwork ¶ added in v1.37.3
func FromBinaryOptionalNetwork(data []byte, addProp additional.Properties, properties *PropertyExtraction, ) (*Object, error)
FromBinaryOptionalNetwork decodes a payload, optionally including/excluding vectors and properties via addProp, and reads Object.Class from the on-disk bytes. The on-disk class is not authoritative; use FromBinaryOptionalDisk when you have a className in scope.
func FromBinaryUUIDOnlyDisk ¶ added in v1.37.3
FromBinaryUUIDOnlyDisk is a header-only fast path that decodes the ID, doc ID, timestamps, and class — vectors, properties, and the rest of the payload are skipped. The caller-supplied class name is stamped on the decoded object, ignoring the on-disk class-name field. className must be non-empty; the function returns an error otherwise. There is no FromBinaryUUIDOnlyNetwork variant — this fast path runs only against bucket reads where a bucket className is always available.
func FromObject ¶
func FromObject(object *models.Object, vector []float32, vectors map[string][]float32, multivectors map[string][][]float32) *Object
TODO: temporary solution
func ObjectsByDocID ¶
func ObjectsByDocID(bucket bucket, ids []uint64, additional additional.Properties, properties []string, logger logrus.FieldLogger, ) ([]*Object, error)
ObjectsByDocID resolves a batch of doc IDs against the given bucket and returns the decoded objects, dropping entries whose payload is missing. Object.Class on each decoded object is stamped from bucket.ClassName(); the bucket must have been opened with lsmkv.WithClassName, otherwise bucket.ClassName() returns an error and the call fails.
func ObjectsByDocIDWithEmpty ¶ added in v1.34.16
func ObjectsByDocIDWithEmpty(bucket bucket, ids []uint64, additional additional.Properties, properties []string, logger logrus.FieldLogger, ) ([]*Object, error)
ObjectsByDocIDWithEmpty is like ObjectsByDocID but preserves nil entries at positions where a doc ID has no payload, so the returned slice always has the same length as ids. Object.Class is stamped from bucket.ClassName() — see ObjectsByDocID for the bucket-resolution contract.
func (*Object) AdditionalProperties ¶
func (ko *Object) AdditionalProperties() models.AdditionalProperties
AdditionalProperties groups all properties which are stored with the object and not generated at runtime
func (*Object) CreationTimeUnix ¶
func (*Object) DeepCopyDangerous ¶
DeepCopyDangerous creates a deep copy of the underlying Object WARNING: This was purpose built for the batch ref usecase and only covers the situations that are required there. This means that cases which aren't reflected in that usecase may still contain references. Thus the suffix "Dangerous". If needed, make sure everything is copied and remove the suffix.
func (*Object) ExplainScore ¶
func (*Object) GetVectors ¶ added in v1.27.21
func (*Object) IterateThroughVectorDimensions ¶ added in v1.30.0
IterateThroughVectorDimensions iterates through all vectors present on the Object and invokes the callback with target name and dimensions of the vector.
func (*Object) LastUpdateTimeUnix ¶
func (*Object) MarshalBinary ¶
func (*Object) MarshalBinaryOptional ¶ added in v1.34.11
func (ko *Object) MarshalBinaryOptional(addProps additional.Properties) ([]byte, error)
MarshalBinaryOptional creates the binary representation of a kind object, but conditionally includes vectors and properties based on the additional.Properties parameter. This is useful for network transmission where vectors may not be needed.
If addProps.Vector is false, the main vector will be serialized with length 0. If addProps.NoProps is true, the properties will be serialized with length 0. For target vectors (Vectors and MultiVectors):
- If addProps.IncludeAllTargetVectors is true, ALL target vectors are included
- If addProps.IncludeAllTargetVectors is false and addProps.Vectors is empty, NO target vectors are included
- If addProps.IncludeAllTargetVectors is false and addProps.Vectors has specific names, only those are included
func (*Object) Properties ¶
func (ko *Object) Properties() models.PropertySchema
func (*Object) PropertiesWithAdditional ¶
func (ko *Object) PropertiesWithAdditional( additional additional.Properties, ) models.PropertySchema
func (*Object) SearchResult ¶
func (ko *Object) SearchResult(additional additional.Properties, tenant string) *search.Result
func (*Object) SearchResultWithDist ¶
func (ko *Object) SearchResultWithDist(addl additional.Properties, dist float32) search.Result
func (*Object) SearchResultWithScore ¶ added in v1.24.0
func (ko *Object) SearchResultWithScore(addl additional.Properties, score float32) search.Result
func (*Object) SearchResultWithScoreAndTenant ¶ added in v1.24.5
func (ko *Object) SearchResultWithScoreAndTenant(addl additional.Properties, score float32, tenant string) search.Result
func (*Object) SetProperties ¶
func (ko *Object) SetProperties(schema models.PropertySchema)
func (*Object) UnmarshalBinaryDisk ¶ added in v1.37.3
UnmarshalBinaryDisk decodes onto ko and stamps the supplied className on Object.Class, skipping the on-disk class-name bytes. className must be non-empty.
func (*Object) UnmarshalBinaryNetwork ¶ added in v1.37.3
UnmarshalBinaryNetwork is the object-method form of FromBinaryNetwork: it decodes onto ko and reads Object.Class from the data bytes. Network methods are used for node to node communication. Use UnmarshalBinaryDisk when reading from disk, as the on-disk class-name may be empty.
func (*Object) VectorWeights ¶
func (ko *Object) VectorWeights() models.VectorWeights
type PropertyExtraction ¶ added in v1.27.0
type PropertyExtraction struct {
PropertyPaths [][]string
}
func NewPropExtraction ¶ added in v1.30.0
func NewPropExtraction() *PropertyExtraction
func (*PropertyExtraction) Add ¶ added in v1.30.0
func (pe *PropertyExtraction) Add(props ...string) *PropertyExtraction