2022-09-18 00:06:25 +00:00
|
|
|
import algoliasearch from 'algoliasearch/lite'
|
|
|
|
import { ENV } from 'common/envs/constants'
|
|
|
|
|
|
|
|
export const searchClient = algoliasearch(
|
|
|
|
'GJQPAYENIF',
|
|
|
|
'75c28fc084a80e1129d427d470cf41a3'
|
|
|
|
)
|
|
|
|
|
|
|
|
const indexPrefix = ENV === 'DEV' ? 'dev-' : ''
|
2022-09-18 00:20:50 +00:00
|
|
|
export const searchIndexName =
|
|
|
|
ENV === 'DEV' ? 'dev-contracts' : 'contractsIndex'
|
2022-09-18 00:06:25 +00:00
|
|
|
|
|
|
|
export const getIndexName = (sort: string) => {
|
|
|
|
return `${indexPrefix}contracts-${sort}`
|
|
|
|
}
|
2022-09-22 21:57:48 +00:00
|
|
|
|
2022-10-01 01:07:49 +00:00
|
|
|
export const trendingIndex = searchClient.initIndex(getIndexName('score'))
|
|
|
|
export const newIndex = searchClient.initIndex(getIndexName('newest'))
|
2022-09-22 21:57:48 +00:00
|
|
|
export const probChangeDescendingIndex = searchClient.initIndex(
|
|
|
|
getIndexName('prob-change-day')
|
|
|
|
)
|
|
|
|
export const probChangeAscendingIndex = searchClient.initIndex(
|
|
|
|
getIndexName('prob-change-day-ascending')
|
|
|
|
)
|
|
|
|
export const dailyScoreIndex = searchClient.initIndex(
|
|
|
|
getIndexName('daily-score')
|
|
|
|
)
|