|
|
|
@ -83,9 +83,9 @@ module.exports = {
|
|
|
|
await this.client.indices.create({
|
|
|
|
await this.client.indices.create({
|
|
|
|
index: this.config.indexName,
|
|
|
|
index: this.config.indexName,
|
|
|
|
body: {
|
|
|
|
body: {
|
|
|
|
mappings: {
|
|
|
|
mappings: (this.config.apiVersion === '6.x') ? {
|
|
|
|
_doc: idxBody
|
|
|
|
_doc: idxBody
|
|
|
|
},
|
|
|
|
} : idxBody,
|
|
|
|
settings: {
|
|
|
|
settings: {
|
|
|
|
analysis: {
|
|
|
|
analysis: {
|
|
|
|
analyzer: {
|
|
|
|
analyzer: {
|
|
|
|
@ -229,7 +229,7 @@ module.exports = {
|
|
|
|
async created(page) {
|
|
|
|
async created(page) {
|
|
|
|
await this.client.index({
|
|
|
|
await this.client.index({
|
|
|
|
index: this.config.indexName,
|
|
|
|
index: this.config.indexName,
|
|
|
|
...(this.config.apiVersion !== '8.x' && {type: '_doc'}),
|
|
|
|
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
|
|
|
|
id: page.hash,
|
|
|
|
id: page.hash,
|
|
|
|
body: {
|
|
|
|
body: {
|
|
|
|
suggest: this.buildSuggest(page),
|
|
|
|
suggest: this.buildSuggest(page),
|
|
|
|
@ -251,7 +251,7 @@ module.exports = {
|
|
|
|
async updated(page) {
|
|
|
|
async updated(page) {
|
|
|
|
await this.client.index({
|
|
|
|
await this.client.index({
|
|
|
|
index: this.config.indexName,
|
|
|
|
index: this.config.indexName,
|
|
|
|
...(this.config.apiVersion !== '8.x' && {type: '_doc'}),
|
|
|
|
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
|
|
|
|
id: page.hash,
|
|
|
|
id: page.hash,
|
|
|
|
body: {
|
|
|
|
body: {
|
|
|
|
suggest: this.buildSuggest(page),
|
|
|
|
suggest: this.buildSuggest(page),
|
|
|
|
@ -273,7 +273,7 @@ module.exports = {
|
|
|
|
async deleted(page) {
|
|
|
|
async deleted(page) {
|
|
|
|
await this.client.delete({
|
|
|
|
await this.client.delete({
|
|
|
|
index: this.config.indexName,
|
|
|
|
index: this.config.indexName,
|
|
|
|
...(this.config.apiVersion !== '8.x' && {type: '_doc'}),
|
|
|
|
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
|
|
|
|
id: page.hash,
|
|
|
|
id: page.hash,
|
|
|
|
refresh: true
|
|
|
|
refresh: true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
@ -286,13 +286,13 @@ module.exports = {
|
|
|
|
async renamed(page) {
|
|
|
|
async renamed(page) {
|
|
|
|
await this.client.delete({
|
|
|
|
await this.client.delete({
|
|
|
|
index: this.config.indexName,
|
|
|
|
index: this.config.indexName,
|
|
|
|
...(this.config.apiVersion !== '8.x' && {type: '_doc'}),
|
|
|
|
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
|
|
|
|
id: page.hash,
|
|
|
|
id: page.hash,
|
|
|
|
refresh: true
|
|
|
|
refresh: true
|
|
|
|
})
|
|
|
|
})
|
|
|
|
await this.client.index({
|
|
|
|
await this.client.index({
|
|
|
|
index: this.config.indexName,
|
|
|
|
index: this.config.indexName,
|
|
|
|
...(this.config.apiVersion !== '8.x' && {type: '_doc'}),
|
|
|
|
...(this.config.apiVersion !== '8.x' && { type: '_doc' }),
|
|
|
|
id: page.destinationHash,
|
|
|
|
id: page.destinationHash,
|
|
|
|
body: {
|
|
|
|
body: {
|
|
|
|
suggest: this.buildSuggest(page),
|
|
|
|
suggest: this.buildSuggest(page),
|
|
|
|
@ -362,7 +362,7 @@ module.exports = {
|
|
|
|
index: {
|
|
|
|
index: {
|
|
|
|
_index: this.config.indexName,
|
|
|
|
_index: this.config.indexName,
|
|
|
|
_id: doc.id,
|
|
|
|
_id: doc.id,
|
|
|
|
...(this.config.apiVersion !== '8.x' && {_type: '_doc'})
|
|
|
|
...(this.config.apiVersion !== '8.x' && { _type: '_doc' })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
doc.safeContent = WIKI.models.pages.cleanHTML(doc.render)
|
|
|
|
doc.safeContent = WIKI.models.pages.cleanHTML(doc.render)
|
|
|
|
|