The search functionality is powered by Algolia docsearch.
Configuration is explained here
In the _index.md
of a software version
, we define:
- a
project
parameter, e.g.corda-os
- a
version
parameter, e.g.4.4
The site implicitly gives us a the language for the current set of pages.
We then need to do the following steps:
- These 3 parameters are set in every page inside a software version in their
meta
tags, and are indexed by Algolia, e.g.
<meta name="docsearch:language" content="en">
<meta name="docsearch:version" content="4.3">
<meta name="docsearch:project" content="corda-enterprise">
- We then configure our search page to filter results on these values only when we are within a particular software version to get context aware results.
if (document.querySelector('#search-input')) {
docsearch({
appId: "UX2KMUWFAL",
apiKey: "1fe3367db02689b4aeebc59efad5abaf",
indexName: "docs.corda.net",
inputSelector: "#search-input",
algoliaOptions: {
hitsPerPage: 5,
facetFilters: [
'project:corda-enterprise',
'version:4.3',
'language:en'
]
}
});
}
This should be done periodically by our CI system, but a manual rebuild can be triggered by:
make crawl ALGOLIA_APPLICATION_ID=UX2KMUWFAL ALGOLIA_API_ADMIN_KEY=<THE SECRET WRITE API KEY>
The SECRET WRITE API KEY
can be found by logging into the Algolia Console.
If you need to add a new index in Algolia, typically for a new website and not this one, find someone with admin access, and add a new index.
- Upload your new index (
make crawl
does this for us here). - Configure the index with the attributes for faceting, in our case
project
,version
, andlanguage
.