forked from DebaucheryLibrarian/traxxx
Added Manticore migration and meta text field.
This commit is contained in:
@@ -81,6 +81,7 @@ async function init() {
|
||||
actors text,
|
||||
tag_ids multi,
|
||||
tags text,
|
||||
meta text,
|
||||
date timestamp,
|
||||
created_at timestamp,
|
||||
effective_date timestamp,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const manticore = require('manticoresearch');
|
||||
const { format } = require('date-fns');
|
||||
|
||||
const knex = require('./knex');
|
||||
const logger = require('./logger')(__filename);
|
||||
@@ -54,9 +55,6 @@ async function updateManticoreSearch(releaseIds) {
|
||||
parents.alias;
|
||||
`, releaseIds && [releaseIds]);
|
||||
|
||||
console.log(releaseIds);
|
||||
console.log(scenes);
|
||||
|
||||
const docs = scenes.rows.map((scene) => ({
|
||||
replace: {
|
||||
index: 'scenes',
|
||||
@@ -77,20 +75,17 @@ async function updateManticoreSearch(releaseIds) {
|
||||
actors: scene.actors.map((actor) => actor.f2).join(),
|
||||
tag_ids: scene.tags.map((tag) => tag.f1),
|
||||
tags: scene.tags.map((tag) => tag.f2).join(),
|
||||
meta: scene.date ? format(scene.date, 'y M d') : undefined,
|
||||
stashed: scene.stashed || 0,
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
console.log('docs', docs);
|
||||
|
||||
if (docs.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const data = await indexApi.bulk(docs.map((doc) => JSON.stringify(doc)).join('\n'));
|
||||
|
||||
console.log('data', data);
|
||||
await indexApi.bulk(docs.map((doc) => JSON.stringify(doc)).join('\n'));
|
||||
}
|
||||
|
||||
async function updateSqlSearch(releaseIds) {
|
||||
|
||||
Reference in New Issue
Block a user