feat: algolia search engine

This commit is contained in:
Nick
2019-03-17 21:52:16 -04:00
parent 99a7d5d76d
commit 343d4db0b3
6 changed files with 297 additions and 26 deletions

View File

@@ -3,6 +3,8 @@ const { SearchService, QueryType } = require('azure-search-client')
const request = require('request-promise')
const { pipeline } = require('stream')
/* global WIKI */
module.exports = {
async activate() {
// not used
@@ -20,7 +22,7 @@ module.exports = {
// -> Create Search Index
const indexes = await this.client.indexes.list()
if (!_.find(_.get(indexes, 'result.value', []), ['name', this.config.indexName])) {
WIKI.logger.info(`(SEARCH/AWS) Creating index...`)
WIKI.logger.info(`(SEARCH/AZURE) Creating index...`)
await this.client.indexes.create({
name: this.config.indexName,
fields: [
@@ -74,7 +76,7 @@ module.exports = {
searchMode: 'analyzingInfixMatching',
sourceFields: ['title', 'description', 'content']
}
],
]
})
}
WIKI.logger.info(`(SEARCH/AZURE) Initialization completed.`)