surface

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	http.Stack
	// contains filtered or unexported fields
}

Client for reading/writing Graph-based Nearest Neighbor Surface.

func New

func New(stack http.Stack, host string) *Client

Creates the client for reading/writing Graph-based Nearest Neighbor Surface.

func (*Client) Query

func (api *Client) Query(ctx context.Context, cask curie.IRI, q Query) (*Result, error)

Query nearest neighbor points to the given vector

func (*Client) Write

func (api *Client) Write(ctx context.Context, cask curie.IRI, bag []Vector) error

Write vector(s)

type Hit

type Hit struct {
	UniqueKey []uint8 `json:"key,omitempty"`
	SortKey   []uint8 `json:"sort,omitempty"`
	Rank      float32 `json:"rank"`
}

type Query

type Query struct {
	K        int       `json:"k,omitempty"`
	EfSearch int       `json:"efSearch,omitempty"`
	Distance float32   `json:"distance,omitempty"`
	Query    []float32 `json:"query"`
}

Query points in k-dimension space

type Result

type Result struct {
	Took   time.Duration  `json:"took,omitempty"`
	Source optimum.Source `json:"source,omitempty"`
	Hits   []Hit          `json:"hits,omitempty"`
}

Results from query

type Vector

type Vector struct {
	UniqueKey []uint8   `json:"id,omitempty"`
	SortKey   []uint8   `json:"sk,omitempty"`
	Vector    []float32 `json:"v"`
}

Vector representing point in k-dimension space

type Writer

type Writer struct {
	http.Stack
	// contains filtered or unexported fields
}

Client for streaming to Graph-based Nearest Neighbor Search Algorithms

func NewWriter

func NewWriter(stack http.Stack, host string, cask curie.IRI, chunk int) *Writer

Creates the client for streaming to Graph-based Nearest Neighbor Search Algorithms

func (*Writer) Sync

func (stream *Writer) Sync(ctx context.Context) (err error)

Sync local cache

func (*Writer) Write

func (stream *Writer) Write(ctx context.Context, v Vector) error

Write vector

Jump to

Keyboard shortcuts

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