Authoritex.OpenSearch (Authoritex v3.1.0)

Copy Markdown View Source

Abstract authority that allows using OpenSearch as a backend.

To use this module, you can either use Authoritex.OpenSearch within your authority module and provide the necessary configuration, or you can dynamically create an authority module with the create/5 function.

Configuration

When using use Authoritex.OpenSearch, you must provide the following options:

  • :code (string, required): The code for the authority
  • :uri_prefix (string, required): The URI prefix for the authority's identifiers
  • :description (string, required): A description of the authority
  • :opensearch (keyword, required): OpenSearch configuration options:
    • :endpoint (string, required): The OpenSearch endpoint URL
    • :index (string, required): The OpenSearch index to query
    • :auth (atom or keyword, optional): Authentication method or credentials for OpenSearch (see Authoritex.HTTP.Auth for supported values)

OpenSearch Index

This module expects OpenSearch documents to have the following structure:

{
  "authority": "authority_code",
  "uri": "unique_identifier",
  "label": "primary_label",
  "qualified_label": "qualified_label_with_context",
  "hint": "additional_info_for_disambiguation",
  "variants": ["alternative_label_1", "alternative_label_2", ...]
}

The OpenSearch index mapping should be configured to support full-text search on the label and variants fields, and exact (keyword) match on the authority and uri fields.

Summary

Functions

Dynamically creates an OpenSearch authority module with the given configuration. See the module documentation for configuration details.

Functions

create(name, code, uri_prefix, description, opensearch_opts)

@spec create(atom() | String.t(), String.t(), String.t(), String.t(), keyword()) ::
  module()

Dynamically creates an OpenSearch authority module with the given configuration. See the module documentation for configuration details.