Documentation
¶
Index ¶
- Variables
- func RegisterAdapterFactory(engine Engine, factory AdapterFactory)
- type Adapter
- type AdapterFactory
- type Client
- func NewClient(collector metrics.Collector, adapters ...Adapter) *Client
- func NewClientFromData(d *data.Data, collector ...metrics.Collector) *Client
- func NewClientWithConfig(collector metrics.Collector, searchConfig *config.Search, adapters ...Adapter) *Client
- func NewClientWithPrefix(collector metrics.Collector, prefix string, adapters ...Adapter) *Client
- func (c *Client) BulkDelete(ctx context.Context, index string, documentIDs []string) error
- func (c *Client) BulkIndex(ctx context.Context, index string, documents []any) error
- func (c *Client) BulkIndexWith(ctx context.Context, engine Engine, index string, documents []any) error
- func (c *Client) Delete(ctx context.Context, index, documentID string) error
- func (c *Client) GetAvailableEngines() []Engine
- func (c *Client) GetEngine() Engine
- func (c *Client) GetIndexPrefix() string
- func (c *Client) GetSearchConfig() *config.Search
- func (c *Client) Health(ctx context.Context) map[Engine]error
- func (c *Client) Index(ctx context.Context, req *IndexRequest) error
- func (c *Client) IndexWith(ctx context.Context, engine Engine, req *IndexRequest) error
- func (c *Client) Search(ctx context.Context, req *Request) (*Response, error)
- func (c *Client) SearchWith(ctx context.Context, engine Engine, req *Request) (*Response, error)
- func (c *Client) SetIndexPrefix(prefix string)
- func (c *Client) UpdateSearchConfig(searchConfig *config.Search)
- type Engine
- type Hit
- type IndexRequest
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoEngineAvailable = errors.New("no search engine available") ErrEngineNotFound = errors.New("search engine not found") )
Functions ¶
func RegisterAdapterFactory ¶ added in v0.2.0
func RegisterAdapterFactory(engine Engine, factory AdapterFactory)
RegisterAdapterFactory registers a factory for creating search adapters This is called by search driver packages in their init() functions
Types ¶
type Adapter ¶ added in v0.2.0
type Adapter interface {
Search(ctx context.Context, req *Request) (*Response, error)
Index(ctx context.Context, req *IndexRequest) error
Delete(ctx context.Context, index, id string) error
BulkIndex(ctx context.Context, index string, documents []any) error
BulkDelete(ctx context.Context, index string, documentIDs []string) error
IndexExists(ctx context.Context, indexName string) (bool, error)
CreateIndex(ctx context.Context, indexName string, settings *config.IndexSettings) error
Health(ctx context.Context) error
Type() Engine
}
Adapter interface for search engine implementations
type AdapterFactory ¶ added in v0.2.0
AdapterFactory creates search adapters from data connections
func GetAdapterFactory ¶ added in v0.2.0
func GetAdapterFactory(engine Engine) (AdapterFactory, error)
GetAdapterFactory returns the factory for a given engine
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientFromData ¶ added in v0.2.0
NewClientFromData creates a search client from ncore data layer Automatically detects and creates adapters for available search engines
func NewClientWithConfig ¶
func NewClientWithConfig(collector metrics.Collector, searchConfig *config.Search, adapters ...Adapter) *Client
NewClientWithConfig creates a new search client with configuration
func NewClientWithPrefix ¶
NewClientWithPrefix creates a new search client with index prefix
func (*Client) BulkDelete ¶
func (*Client) BulkIndexWith ¶
func (*Client) GetAvailableEngines ¶
func (*Client) GetIndexPrefix ¶
func (*Client) GetSearchConfig ¶
func (*Client) SearchWith ¶
func (*Client) SetIndexPrefix ¶
func (*Client) UpdateSearchConfig ¶
type Engine ¶
type Engine string
func GetRegisteredEngines ¶ added in v0.2.0
func GetRegisteredEngines() []Engine
GetRegisteredEngines returns list of engines with registered factories
type IndexRequest ¶
Click to show internal directories.
Click to hide internal directories.