algolia

package module
v1.2.11 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

README

Algolia Search (preview)

Algolia is a hosted search engine, offering full-text, numerical, and faceted search, capable of delivering real-time results from the first keystroke. Algolia's powerful API lets you quickly and seamlessly implement search within your websites and mobile applications. Our search API powers billions of queries for thousands of companies every month, delivering relevant results in under 100ms anywhere in the world.

How to use

Algolia Official website

Algolia

Build
./answer build --with github.com/apache/answer-plugins/search-algolia
Configuration
  • Application ID - Your Algolia Application ID.
  • Search-only API Key - Your Algolia Search-only API Key (public).
  • Admin API Key - Your Algolia ADMIN API Key (kept private).
  • Index name prefix - This prefix will be prepended to your index names.
  • Algolia logo - Algolia requires that you keep the logo if you are using a free plan.
Note
  • If you have a large amount of data, it will be synchronized to algolia server auto when plugin configuration completed. If you need to know the specific progress, you need to check the console log information yourself.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewestIndex = "newest"
	ActiveIndex = "active"
	ScoreIndex  = "score"
)
View Source
var AlgoliaSearchServerConfig = []byte(`
{
  "minWordSizefor1Typo": 4,
  "minWordSizefor2Typos": 8,
  "hitsPerPage": 20,
  "maxValuesPerFacet": 100,
  "searchableAttributes": [
    "content",
    "title"
  ],
  "numericAttributesToIndex": null,
  "attributesToRetrieve": null,
  "unretrievableAttributes": null,
  "optionalWords": null,
  "attributesForFaceting": [
    "status",
    "tags",
    "type",
    "user_id"
  ],
  "attributesToSnippet": null,
  "attributesToHighlight": null,
  "paginationLimitedTo": 1000,
  "attributeForDistinct": null,
  "exactOnSingleWordQuery": "attribute",
  "ranking": [
    "desc(active)",
    "desc(score)",
    "desc(created)",
    "typo",
    "geo",
    "words",
    "filters",
    "proximity",
    "attribute",
    "exact",
    "custom"
  ],
  "customRanking": [
    "desc(title)",
    "desc(content)"
  ],
  "separatorsToIndex": "",
  "removeWordsIfNoResults": "none",
  "queryType": "prefixLast",
  "highlightPreTag": "<em>",
  "highlightPostTag": "</em>",
  "alternativesAsExact": [
    "ignorePlurals",
    "singleWordSynonym"
  ]
}
`)
View Source
var Info embed.FS

Functions

This section is empty.

Types

type AlgoliaSearchConfig

type AlgoliaSearchConfig struct {
	APPID        string `json:"app_id"`
	PublicAPIKey string `json:"public_api_key"`
	APIKey       string `json:"api_key"`
	Index        string `json:"index"`
}

type SearchAlgolia

type SearchAlgolia struct {
	Config *AlgoliaSearchConfig
	// contains filtered or unexported fields
}

func (*SearchAlgolia) ConfigFields

func (s *SearchAlgolia) ConfigFields() []plugin.ConfigField

ConfigFields return config fields

func (*SearchAlgolia) ConfigReceiver

func (s *SearchAlgolia) ConfigReceiver(config []byte) error

ConfigReceiver receive config from admin

func (*SearchAlgolia) DeleteContent

func (s *SearchAlgolia) DeleteContent(ctx context.Context, contentID string) (err error)

DeleteContent deletes the content

func (*SearchAlgolia) Description

func (s *SearchAlgolia) Description() plugin.SearchDesc

func (*SearchAlgolia) Info

func (s *SearchAlgolia) Info() plugin.Info

func (*SearchAlgolia) RegisterSyncer

func (s *SearchAlgolia) RegisterSyncer(ctx context.Context, syncer plugin.SearchSyncer)

func (*SearchAlgolia) SearchAnswers

func (s *SearchAlgolia) SearchAnswers(ctx context.Context, cond *plugin.SearchBasicCond) (res []plugin.SearchResult, total int64, err error)

func (*SearchAlgolia) SearchContents

func (s *SearchAlgolia) SearchContents(ctx context.Context, cond *plugin.SearchBasicCond) (res []plugin.SearchResult, total int64, err error)

func (*SearchAlgolia) SearchQuestions

func (s *SearchAlgolia) SearchQuestions(ctx context.Context, cond *plugin.SearchBasicCond) (res []plugin.SearchResult, total int64, err error)

func (*SearchAlgolia) UpdateContent

func (s *SearchAlgolia) UpdateContent(ctx context.Context, content *plugin.SearchContent) (err error)

UpdateContent updates the content to algolia server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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