oracle

package module
v0.61.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package oracle indexes precomputed vectors in a Host-provisioned SQL table. Upsert and ranked queries recheck the durable space marker and native fixed vector dimension. Deletion uses the table selected by the Host directly. Dimensions in StoreConfig seeds only a newly created column; no model, tokenization or embedding call occurs inside the adapter. Configured schema, table and column names use Oracle's uppercase identity; SQL quotes that canonical name so reserved words remain valid identifiers. Content requires a non-null CLOB in an AL32UTF8 database. Construction checks the character set before optional schema creation, and native bindings recheck it before admission and writes because driver conversion can silently replace unsupported Unicode characters. Metadata retains exact encoded bytes in BLOB.

Query performs native nearest-neighbor ranking without enumerating metadata. The stored metadata representation cannot implement exact Core predicates natively, so a filtered Query fails with vectorstore.ErrUnsupportedFilter. A Host authorized for the whole table can explicitly QueryByScan or DeleteMatching using a finite vectorstore.ScanBudget. In the scan transaction, the adapter bounds source records and the ID/metadata bytes of its two passes before reading their payload; native ranking, protocol overhead and server work are not included in the payload bound. On exhaustion there is no partial result.

Upsert prepares every vector before issuing writes. One failed row reports prior native acknowledgments, its unknown status and subsequent unattempted rows. The Host owns the DB handle and any decision to reconcile or retry. Rebuild unmarked tables; do not label previously unverified coordinates.

Index

Constants

View Source
const (
	DefaultTableName       = "VECTOR_STORE"
	DefaultIDColumn        = "ID"
	DefaultContentColumn   = "CONTENT"
	DefaultMetadataColumn  = "METADATA"
	DefaultEmbeddingColumn = "EMBEDDING"
	DefaultDistanceMetric  = DistanceCosine
)
View Source
const Provider = "Oracle"

Variables

This section is empty.

Functions

This section is empty.

Types

type DistanceMetric

type DistanceMetric string

DistanceMetric values mirror Oracle's accepted VECTOR_DISTANCE tokens exactly so they can flow straight into the SQL.

const (
	DistanceCosine DistanceMetric = "COSINE"

	DistanceEuclidean DistanceMetric = "EUCLIDEAN"

	// DistanceDot is Oracle's negative inner-product distance, not a bounded
	// similarity.
	DistanceDot DistanceMetric = "DOT"
)

func (DistanceMetric) String

func (d DistanceMetric) String() string

func (DistanceMetric) Valid

func (d DistanceMetric) Valid() bool

type Store

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

func NewStore

func NewStore(ctx context.Context, config StoreConfig) (*Store, error)

NewStore creates the table when requested and verifies the current storage contract. The host owns the database handle. An omitted schema is bound to the connection's current schema at construction.

func (*Store) CheckDocuments added in v0.59.0

func (s *Store) CheckDocuments(ctx context.Context, space vectorstore.SpaceID, docs []*document.Document) error

func (*Store) CheckQuery added in v0.59.0

func (s *Store) CheckQuery(ctx context.Context, space vectorstore.SpaceID, opts vectorstore.SearchOptions) error

func (*Store) DeleteIDs

func (s *Store) DeleteIDs(ctx context.Context, ids []string) (err error)

func (*Store) DeleteMatching added in v0.59.0

func (s *Store) DeleteMatching(ctx context.Context, predicate filter.Predicate, budget vectorstore.ScanBudget) (err error)

func (*Store) Query added in v0.59.0

func (*Store) QueryByScan added in v0.60.0

func (*Store) Upsert added in v0.59.0

func (s *Store) Upsert(ctx context.Context, batch *vectorstore.Batch) (err error)

type StoreConfig

type StoreConfig struct {
	// DB must be a *sql.DB built from github.com/sijms/go-ora/v3 pointed at
	// an Oracle 23ai instance.
	DB *sql.DB

	SchemaName string

	TableName string

	IDColumn        string
	ContentColumn   string
	MetadataColumn  string
	EmbeddingColumn string

	Space vectorstore.SpaceID

	// Dimensions seeds a newly created VECTOR column; the native column owns
	// the stored dimension constraint, and runtime vectors derive width from
	// their input.
	Dimensions int

	DistanceMetric DistanceMetric

	InitializeSchema bool
}

func (StoreConfig) Validate

func (s StoreConfig) Validate() error

Jump to

Keyboard shortcuts

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