Represents a collection of documents for segmentation.
Collections allow you to organize documents by product, country, or any other grouping criteria. Documents can be filtered by collection when searching.
Summary
Functions
Gets an existing collection by name or creates a new one.
Extracts collection names from search/ask opts.
Resolves a list of collection names to their IDs.
Functions
Gets an existing collection by name or creates a new one.
If a description is provided and the collection already exists, the description is updated only if the existing one is nil or empty.
Examples
{:ok, collection} = Collection.get_or_create("products", MyRepo)
{:ok, collection} = Collection.get_or_create("default", MyRepo)
{:ok, collection} = Collection.get_or_create("docs", MyRepo, "Official documentation")
Extracts collection names from search/ask opts.
Looks for :collections (list) or :collection (single name).
Returns [nil] if neither is set.
Resolves a list of collection names to their IDs.
Returns nil for unscoped queries (when collections is [nil]),
otherwise returns a list of UUIDs (possibly empty).