Go SDK
The official Go SDK for brinicle provides an idiomatic HTTP client with context support, functional options, and comprehensive type definitions.Installation
Quick Start
Configuration
Functional Options
| Option | Description |
|---|---|
WithTimeout(d time.Duration) | Set the request timeout |
WithHTTPClient(c *http.Client) | Use a custom HTTP client |
API Reference
All methods accept acontext.Context as the first argument, enabling cancellation and timeout control.
HealthCheck
CreateIndex
ListIndexes
DeleteIndex
GetIndexStatus
LoadIndex
Init
Ingest
IngestBatch
Finalize
DeleteItems
Rebuild
Search
Optimize
ItemSearch
The ItemSearch API enables structured search over items with lexical fields, combining vector similarity with metadata filtering. Unlike the basic vector search which operates on raw embeddings, ItemSearch lets you ingest items with human-readable fields such as titles, descriptions, and categories, then perform filtered searches that combine full-text matching with vector similarity. This makes it ideal for product catalogs, document collections, and any dataset where you need to search by both content and structured attributes. Each item index is backed by its own vector index, so you still benefit from brinicle’s high-performance HNSW graph for similarity lookups. The difference is that ItemSearch adds a lexical configuration layer that controls how text fields are tokenized and matched, allowing you to fine-tune relevance for your specific domain. The Go SDK provides strongly-typed structs for all ItemSearch operations, including filters, results, and configuration objects.CreateItemIndex
Create a new item search index with an optional lexical configuration. TheLexicalConfig struct controls how text fields are analyzed during ingestion and search — you can specify which fields are searchable, how they are tokenized, and whether stemming or stop-word removal should be applied. If nil, a default configuration is used that treats all text fields as searchable with standard tokenization. Like all Go SDK methods, this accepts a context.Context as the first argument for cancellation and timeout control.
InitItemIngest
Initialize an ingest session for an item index. This works identically to the vector engine’sInit method, accepting an IngestMode constant. You must call this before ingesting any items, and you must call Finalize after all items have been ingested. The build mode creates a fresh index from scratch, while insert and upsert modes allow you to add or update items in an existing index.
IngestItem
Ingest a single item with its external ID, vector, and associated metadata fields. TheItem struct provides the structure for the item parameter, including the ExternalID, Vector, and Fields fields. Fields not listed in the SearchableFields of the LexicalConfig are stored but not indexed for text search. The vector must match the dimension specified during index creation.
SearchItems
Search for items using a combination of vector similarity and structured filters. Thequery parameter provides the text query which is matched against the searchable fields defined in the lexical configuration. The filters parameter accepts an ItemSearchFilters struct with Must and MustNot conditions that narrow results by exact field values or ranges. The response is a typed ItemSearchResponse containing an array of ItemSearchResult structs with item IDs, scores, and matched fields.
DeleteItemIndex
Delete or close an item search index. When called withdestroy: false, the index is closed but its data remains on disk and can be reloaded later. When called with destroy: true, the index and all its data are permanently removed. This method is identical in behavior to DeleteIndex but operates on item search indexes specifically.
GetItemIndexStatus
Check the status of an item search index. Returns the index name, dimension, whether the HNSW graph has been built, and whether a rebuild is needed after recent ingestions. This is useful for monitoring the health of your indexes and determining when a rebuild or optimization might be necessary.Autocomplete
The Autocomplete API provides prefix-based search for type-ahead and suggestion use cases. Autocomplete indexes are optimized for fast prefix matching, making them ideal for search boxes, tag suggestion, and any interface where users type partial queries and expect instant results. Unlike ItemSearch which combines vector similarity with text matching, Autocomplete focuses on sub-millisecond prefix lookups over string keys. Each autocomplete index stores a set of string keys and their associated vectors. When a user types a partial query, the engine searches for keys that begin with the typed prefix and returns the closest matches ranked by vector similarity. This allows you to build autocomplete experiences that are both fast and semantically relevant — for example, typing “iph” could suggest “iPhone 15 Pro Max” based on both the prefix match and the semantic proximity to other electronics products.CreateAutocompleteIndex
Create a new autocomplete index with an optional autocomplete configuration. TheAutocompleteConfig struct controls how suggestions are matched and ranked — for example, you can set the minimum prefix length before suggestions are returned, the maximum number of suggestions, and whether to apply fuzzy matching for typo tolerance. If nil, sensible defaults are used that work well for most use cases.
InitAutocompleteIngest
Initialize an ingest session for an autocomplete index. Like the vector engine’sInit method, this must be called before ingesting any autocomplete entries. The mode controls whether you are building a new index from scratch or adding entries to an existing one. After ingesting all entries, you must call Finalize to commit the data and build the prefix index.
IngestAutocomplete
Ingest a single autocomplete entry with its key string and associated vector. The key is the string that users will type as a prefix — for example, a product name like “iPhone 15 Pro Max”. The vector provides the semantic representation used to rank suggestions when multiple prefix matches exist. Keys should be lowercase if theAutocompleteConfig specifies Lowercase: true, as the engine will not automatically normalize keys during ingestion.
SearchAutocomplete
Search for autocomplete suggestions matching a given prefix. Thequery parameter is the partial string typed by the user, and the k parameter controls how many suggestions to return. Results are ranked by a combination of prefix match quality and vector similarity, ensuring that the most relevant suggestions appear first. This method is designed for sub-millisecond response times, making it suitable for interactive type-ahead interfaces.
DeleteAutocompleteIndex
Delete or close an autocomplete index. When called withdestroy: false, the index is closed but its data remains on disk. When called with destroy: true, the index and all associated data are permanently removed from disk. Use this method to clean up indexes that are no longer needed or to force a full rebuild by destroying and recreating an index.
GetAutocompleteIndexStatus
Check the status of an autocomplete index. Returns the index name, vector dimension, whether the prefix index has been built, and whether a rebuild is needed after recent ingestions. Monitoring index status is important for autocomplete indexes because the prefix index must be rebuilt after ingestion to reflect new entries.Error Handling
Context and Cancellation
All operations support Go’scontext.Context for cancellation and timeout:
Type Reference
ItemSearch Types
The following types are used by the ItemSearch API. TheItem struct represents a single item to ingest, with its ID, vector, and metadata fields. The ItemSearchFilters struct provides structured filtering with Must and MustNot conditions. The ItemSearchResult struct represents a single search result with score and matched fields, and ItemSearchResponse wraps the full response including result count.
Autocomplete Types
The following types are used by the Autocomplete API. TheAutocompleteConfig struct controls how the autocomplete engine matches prefixes and ranks suggestions, including options for fuzzy matching and minimum prefix length.