Operations for working with DSpace search ("discovery").
Provides functionality for searching across "DSpace objects" including items, collections, and communities. Supports faceted search, filtering, and sorting.
Summary
Functions
Fetches information on the search configuration.
Fetches values for a specific search facet.
Fetches available facets for the given search context.
Fetches the available search filters and their specifications.
Fetches the available sort options.
Performs a search query using the "Discovery" search endpoint.
Types
Functions
@spec fetch_config() :: DSpace.API.Operation.JSON.t()
Fetches information on the search configuration.
Returns the available filters, operators, and sort options.
@spec fetch_facet_values( binary(), keyword() ) :: DSpace.API.Operation.JSON.t()
Fetches values for a specific search facet.
Retrieves the possible values and their counts for a single facet field. Useful for building facet selection interfaces.
This operation can be streamed.
Parameters
facet_name- The name of the facet (e.g., "author", "subject", "dateIssued")options- Search context and pagination options, seequery/1options
@spec fetch_facets(keyword()) :: DSpace.API.Operation.JSON.t()
Fetches available facets for the given search context.
Returns facets that can be used to refine search results. Uses the same search context (query, scope, configuration, filters) but returns facet information instead of search results.
This operation can be streamed.
Parameters
options- Search context and pagination options, seequery/1options
@spec fetch_filters() :: DSpace.API.Operation.JSON.t()
Fetches the available search filters and their specifications.
@spec fetch_sort_options() :: DSpace.API.Operation.JSON.t()
Fetches the available sort options.
@spec query(query_string :: binary() | search_options()) :: DSpace.API.Operation.JSON.t()
Performs a search query using the "Discovery" search endpoint.
This function takes either
- a search query as a string or
- a search context as a keyword list of options
This operation can be streamed.
Options
:query- The search query string (optional for scope-only searches):scope- UUID of a specific DSpace container (community, collection, etc.) to limit search scope:configuration- Name of Discovery configuration to use as a string or atom:workspace- Search user's draft items (requires authentication):workflow- Search editorial workflow items (requires authentication)- Custom configuration names as defined in the DSpace instance's
discovery.xml
:filters- List of filter maps to refine search results. Each filter must have::filter- The filter (e.g., "itemtype", "title", "author", "subject", "dateIssued"):operator- The filter operator (e.g., "equals", "notequals", "contains", "notcontains", "authority", "notauthority"):value- The filter value to match against
:sort- Sort specification for results. Can be:- A string or atom for field name (defaults to ascending order)
- A tuple
{field, direction}where direction is:ascor:desc. Common sort fields:"score"- Relevance score (use:descfor most relevant first)"dc.date.issued"- Publication date"dc.date.accessioned"- Date added to repository"dc.title"- Title (use:ascfor A-Z alphabetical)
:page- Page number (0-based, defaults to 0):size- Number of items per page (usually defaults to 20)