/** Full Search ================================================================================ This file's main focus in providing the Meilisearch features to the search.html template. For more information on Meilisearch, use: - https://docs.meilisearch.com/ - https://github.com/meilisearch/instant-meilisearch Meilisearch provides an 'InstantSearch' add-on (plug-in?) which links the Meilisearch instance you have running to this website (link above for more information). */ let server = ""; let apiKey = ""; if (location.hostname === "localhost" || location.hostname === "127.0.0.1" || location.hostname === "beta.nera.com") { server = "http://localhost:7700"; apiKey= "meilisearch-beta-key"; } else { server = "https://www.nera.net"; apiKey = "meilisearch-production-key-nera"; } const search = instantsearch({ indexName: "nera", searchClient: instantMeiliSearch( server, apiKey, { primaryKey: 'id', } ) }); search.addWidgets([ instantsearch.widgets.searchBox({ container: "#searchbox", placeholder: "Search the archive here...", }), instantsearch.widgets.clearRefinements({ container: "#clear-refinements" }), instantsearch.widgets.refinementList({ container: "#year-list", attribute: "year" }), instantsearch.widgets.refinementList({ container: "#month-list", attribute: "month" }), instantsearch.widgets.refinementList({ container: "#keywords-list", attribute: "keywords" }), instantsearch.widgets.configure({ hitsPerPage: 50, snippetEllipsisText: "...", attributesToSnippet: ["title:100"] }), instantsearch.widgets.hits({ container: "#hits", templates: { item: `
{{#helpers.highlight}}{"attribute": "title"}{{/helpers.highlight}} {{#helpers.highlight}}{"attribute": "month"}{{/helpers.highlight}} {{#helpers.highlight}}{"attribute": "year"}{{/helpers.highlight}} {{keywords}}
` } }), instantsearch.widgets.pagination({ container: "#pagination" }) ]); search.start();