MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / CreateCollection

Method CreateCollection

internal/search/search.go:203–212  ·  view source on GitHub ↗

CreateCollection creates a collection in Typesense based on the provided schema. If the collection already exists, it will return without error.

(ctx context.Context, schema *api.CollectionSchema)

Source from the content-addressed store, hash-verified

201// CreateCollection creates a collection in Typesense based on the provided schema.
202// If the collection already exists, it will return without error.
203func (t *TypesenseClient) CreateCollection(ctx context.Context, schema *api.CollectionSchema) (*api.CollectionResponse, error) {
204 resp, err := t.Client.Collections().Create(ctx, schema)
205 if err != nil {
206 if strings.Contains(err.Error(), "already exists") {
207 return nil, nil
208 }
209 return nil, err
210 }
211 return resp, nil
212}
213
214// Search performs a search query on a specific collection with the provided search parameters.
215func (t *TypesenseClient) Search(ctx context.Context, collection string, searchParams *api.SearchCollectionParams) (*api.SearchResult, error) {

Callers 1

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected