zinc

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package zinc provides the ZincSearch client for full-text search.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Index operations
	CreateIndex(ctx context.Context, name string, mapping map[string]interface{}) error
	DeleteIndex(ctx context.Context, name string) error
	IndexExists(ctx context.Context, name string) (bool, error)
	GetIndexStats(ctx context.Context, name string) (*models.IndexStats, error)

	// Document operations
	IndexDocument(ctx context.Context, index string, id string, doc interface{}) error
	UpdateDocument(ctx context.Context, index string, id string, updates map[string]interface{}) error
	DeleteDocument(ctx context.Context, index string, id string) error
	GetDocument(ctx context.Context, index string, id string) (map[string]interface{}, error)
	BulkIndex(ctx context.Context, index string, docs []interface{}) error

	// Search operations
	Search(ctx context.Context, index string, query *models.SearchRequest) (*models.SearchResult, error)
	Suggest(ctx context.Context, index string, text string, field string) ([]string, error)
}

Client interface for Zinc search operations.

type MockZincClient

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

MockZincClient is a mock implementation of the Client interface for testing.

func NewMockZincClient

func NewMockZincClient() *MockZincClient

NewMockZincClient creates a new mock Zinc client.

func (*MockZincClient) BulkIndex

func (c *MockZincClient) BulkIndex(ctx context.Context, index string, docs []interface{}) error

BulkIndex indexes multiple documents.

func (*MockZincClient) CreateIndex

func (c *MockZincClient) CreateIndex(ctx context.Context, name string, mapping map[string]interface{}) error

CreateIndex creates a new index.

func (*MockZincClient) DeleteDocument

func (c *MockZincClient) DeleteDocument(ctx context.Context, index string, id string) error

DeleteDocument deletes a document.

func (*MockZincClient) DeleteIndex

func (c *MockZincClient) DeleteIndex(ctx context.Context, name string) error

DeleteIndex deletes an index.

func (*MockZincClient) GetDocument

func (c *MockZincClient) GetDocument(ctx context.Context, index string, id string) (map[string]interface{}, error)

GetDocument retrieves a document.

func (*MockZincClient) GetIndexStats

func (c *MockZincClient) GetIndexStats(ctx context.Context, name string) (*models.IndexStats, error)

GetIndexStats retrieves statistics for an index.

func (*MockZincClient) IndexDocument

func (c *MockZincClient) IndexDocument(ctx context.Context, index string, id string, doc interface{}) error

IndexDocument indexes a single document.

func (*MockZincClient) IndexExists

func (c *MockZincClient) IndexExists(ctx context.Context, name string) (bool, error)

IndexExists checks if an index exists.

func (*MockZincClient) Search

func (c *MockZincClient) Search(ctx context.Context, index string, query *models.SearchRequest) (*models.SearchResult, error)

Search performs a search query.

func (*MockZincClient) Suggest

func (c *MockZincClient) Suggest(ctx context.Context, index string, text string, field string) ([]string, error)

Suggest provides search suggestions.

func (*MockZincClient) UpdateDocument

func (c *MockZincClient) UpdateDocument(ctx context.Context, index string, id string, updates map[string]interface{}) error

UpdateDocument updates a document.

type ZincClient

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

ZincClient implements the Client interface for Zinc.

func NewZincClient

func NewZincClient(baseURL, username, password string) *ZincClient

NewZincClient creates a new Zinc client.

func (*ZincClient) BulkIndex

func (c *ZincClient) BulkIndex(ctx context.Context, index string, docs []interface{}) error

BulkIndex indexes multiple documents.

func (*ZincClient) CreateIndex

func (c *ZincClient) CreateIndex(ctx context.Context, name string, mapping map[string]interface{}) error

CreateIndex creates a new index with optional mapping.

func (*ZincClient) DeleteDocument

func (c *ZincClient) DeleteDocument(ctx context.Context, index string, id string) error

DeleteDocument deletes a document.

func (*ZincClient) DeleteIndex

func (c *ZincClient) DeleteIndex(ctx context.Context, name string) error

DeleteIndex deletes an index.

func (*ZincClient) GetDocument

func (c *ZincClient) GetDocument(ctx context.Context, index string, id string) (map[string]interface{}, error)

GetDocument retrieves a document.

func (*ZincClient) GetIndexStats

func (c *ZincClient) GetIndexStats(ctx context.Context, name string) (*models.IndexStats, error)

GetIndexStats retrieves statistics for an index.

func (*ZincClient) IndexDocument

func (c *ZincClient) IndexDocument(ctx context.Context, index string, id string, doc interface{}) error

IndexDocument indexes a single document.

func (*ZincClient) IndexExists

func (c *ZincClient) IndexExists(ctx context.Context, name string) (bool, error)

IndexExists checks if an index exists.

func (*ZincClient) Search

func (c *ZincClient) Search(ctx context.Context, index string, query *models.SearchRequest) (*models.SearchResult, error)

Search performs a search query.

func (*ZincClient) Suggest

func (c *ZincClient) Suggest(ctx context.Context, index string, text string, field string) ([]string, error)

Suggest provides search suggestions.

func (*ZincClient) UpdateDocument

func (c *ZincClient) UpdateDocument(ctx context.Context, index string, id string, updates map[string]interface{}) error

UpdateDocument updates a document.

Jump to

Keyboard shortcuts

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