1
0
mirror of synced 2025-12-21 19:06:49 -05:00
Files
docs/lib/search/algolia-get-remote-index-names.js

15 lines
477 B
JavaScript

const { namePrefix } = require('./config')
const getAlgoliaClient = require('./algolia-client')
module.exports = async function getRemoteIndexNames () {
const algoliaClient = getAlgoliaClient()
const indices = await algoliaClient.listIndices()
// ignore other indices that may be present in the Algolia account like `helphub-`, etc
const indexNames = indices.items
.map(field => field.name)
.filter(name => name.startsWith(namePrefix))
return indexNames
}