mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
7919017118
[web] de-ng contact form GitOrigin-RevId: 8a92b37163555d6466e4b8c565f1ef490f73d49a
19 lines
543 B
JavaScript
19 lines
543 B
JavaScript
import _ from 'lodash'
|
|
import AlgoliaSearch from 'algoliasearch'
|
|
import getMeta from '../../utils/meta'
|
|
|
|
let wikiIdx
|
|
export async function searchWiki(...args) {
|
|
if (!wikiIdx) {
|
|
const algoliaConfig = getMeta('ol-algolia')
|
|
const wikiIndex = _.get(algoliaConfig, 'indexes.wiki')
|
|
if (wikiIndex) {
|
|
const client = AlgoliaSearch(algoliaConfig.appId, algoliaConfig.apiKey)
|
|
wikiIdx = client.initIndex(wikiIndex)
|
|
}
|
|
}
|
|
if (!wikiIdx) {
|
|
return { hits: [], nbHits: 0, nbPages: 0 }
|
|
}
|
|
return wikiIdx.search(...args)
|
|
}
|