algolia

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2023 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package algolia contains logic for working with Algolia.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlgoliaProxyHandler

func AlgoliaProxyHandler(
	c *Client, cfg *Config, log hclog.Logger) http.Handler

AlgoliaProxyHandler proxies Algolia API requests from the Hermes frontend.

Types

type Client

type Client struct {
	*search.Client

	// Docs is an Algolia index for searching documents.
	Docs *search.Index

	// DocsCreatedTimeAsc is an Algolia replica of the docs index that is sorted
	// by ascending created time.
	DocsCreatedTimeAsc *search.Index

	// DocsCreatedTimeDesc is an Algolia replica of the docs index that is sorted
	// by descending created time.
	DocsCreatedTimeDesc *search.Index

	// DocsModifiedTimeDesc is an Algolia replica of the docs index that is sorted
	// by descending modified time.
	DocsModifiedTimeDesc *search.Index

	// Drafts is an Algolia index for storing metadata for draft documents.
	Drafts *search.Index

	// DraftsCreatedTimeAsc is an Algolia replica of the drafts index that is sorted
	// by ascending created time.
	DraftsCreatedTimeAsc *search.Index

	// DraftsCreatedTimeDesc is an Algolia replica of the drafts index that is sorted
	// by descending created time.
	DraftsCreatedTimeDesc *search.Index

	// DraftsModifiedTimeDesc is an Algolia replica of the drafts index that is sorted
	// by descending modified time.
	DraftsModifiedTimeDesc *search.Index

	// Internal is an Algolia index for storing internal Hermes metadata.
	Internal *search.Index

	// Links is an Algolia index for storing links of documents
	Links *search.Index

	// MissingFields is an Algolia index for storing missing fields from indexed
	// documents.
	MissingFields *search.Index
}

Client provides access to Hermes indexes in Algolia.

func New

func New(cfg *Config) (*Client, error)

New initializes Hermes indices and returns a new Algolia client for indexing data.

func NewSearchClient

func NewSearchClient(cfg *Config) (*Client, error)

NewSearchClient returns a new Algolia client for searching indices.

type Config

type Config struct {
	// ApplicationID is the Algolia Application ID.
	ApplicationID string `hcl:"application_id,optional"`

	// DocsIndexName is the name of the Algolia index for storing document
	// metadata.
	DocsIndexName string `hcl:"docs_index_name,optional"`

	// DraftsIndexName is the name of the Algolia index for storing draft
	// documents' metadata.
	DraftsIndexName string `hcl:"drafts_index_name,optional"`

	// InternalIndexName is the name of the Algolia index for storing internal
	// Hermes metadata.
	InternalIndexName string `hcl:"internal_index_name,optional"`

	// LinksIndexName is the name of the Algolia index for storing links
	LinksIndexName string `hcl:"links_index_name,optional"`

	// MissingFieldsIndexName is the name of the Algolia index for storing missing
	// fields from indexed documents.
	MissingFieldsIndexName string `hcl:"missing_fields_index_name,optional"`

	// SearchAPIKey is the Algolia API Key for searching Hermes indices.
	SearchAPIKey string `hcl:"search_api_key,optional"`

	// WriteAPIKey is the Algolia API Key for writing to Hermes indices.
	WriteAPIKey string `hcl:"write_api_key,optional"`
}

Config is the configuration for interacting with the Algolia API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL