Documentation
¶
Overview ¶
Package indexer defines callback payloads used by indexers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetImplSpecificOptions ¶ added in v0.3.6
GetImplSpecificOptions extract the implementation specific options from Option list, optionally providing a base options with default values. e.g.
myOption := &MyOption{
Field1: "default_value",
}
myOption := model.GetImplSpecificOptions(myOption, opts...)
Types ¶
type CallbackInput ¶
type CallbackInput struct {
// Docs is the documents to be indexed.
Docs []*schema.Document
// Extra is the extra information for the callback.
Extra map[string]any
}
CallbackInput is the input for the indexer callback.
func ConvCallbackInput ¶
func ConvCallbackInput(src callbacks.CallbackInput) *CallbackInput
ConvCallbackInput converts the callback input to the indexer callback input.
type CallbackOutput ¶
type CallbackOutput struct {
// IDs is the ids of the indexed documents returned by the indexer.
IDs []string
// Extra is the extra information for the callback.
Extra map[string]any
}
CallbackOutput is the output for the indexer callback.
func ConvCallbackOutput ¶
func ConvCallbackOutput(src callbacks.CallbackOutput) *CallbackOutput
ConvCallbackOutput converts the callback output to the indexer callback output.
type Indexer ¶
type Indexer interface {
// Store stores the documents.
Store(ctx context.Context, docs []*schema.Document, opts ...Option) (ids []string, err error) // invoke
}
Indexer is the interface for the indexer. Indexer is used to store the documents.
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option is the call option for Indexer component.
func WithEmbedding ¶
WithEmbedding is the option to set the embedder for the indexer, which convert document to embeddings.
func WithSubIndexes ¶
WithSubIndexes is the option to set the sub indexes for the indexer.
func WrapImplSpecificOptFn ¶ added in v0.3.6
WrapImplSpecificOptFn is the option to wrap the implementation specific option function.
type Options ¶
type Options struct {
// SubIndexes is the sub indexes to be indexed.
SubIndexes []string
// Embedding is the embedding component.
Embedding embedding.Embedder
}
Options is the options for the indexer.
func GetCommonOptions ¶
GetCommonOptions extract indexer Options from Option list, optionally providing a base Options with default values. e.g.
indexerOption := &IndexerOption{
SubIndexes: []string{"default_sub_index"}, // default value
}
indexerOption := indexer.GetCommonOptions(indexerOption, opts...)