1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/script/search/algolia-get-remote-index-names.js
Kevin Heis 8a56437c93 Pretty format (#20352)
* Update prettier flow to include JS

* Run prettier

* ...run prettier
2021-07-14 14:35:01 -07:00

16 lines
509 B
JavaScript

#!/usr/bin/env node
import { namePrefix } from '../../lib/search/config.js'
import getAlgoliaClient from './algolia-client.js'
export default 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
}