Serializing aliased actors as searchable text field in manticore.
This commit is contained in:
11
src/sync.js
11
src/sync.js
@@ -382,11 +382,14 @@ export async function syncManticoreActors(actorIds) {
|
||||
const actors = await knex.raw(`
|
||||
SELECT
|
||||
actors.*,
|
||||
actors_meta.*,
|
||||
date_of_birth AT TIME ZONE 'Europe/Amsterdam' AT TIME ZONE 'UTC' as dob
|
||||
actors_meta.stashed, actors_meta.scenes,
|
||||
STRING_AGG(DISTINCT aliases.name, ',') FILTER (WHERE LOWER(aliases.name) != LOWER(actors.name)) as alias,
|
||||
actors.date_of_birth AT TIME ZONE 'Europe/Amsterdam' AT TIME ZONE 'UTC' as dob
|
||||
FROM actors
|
||||
LEFT JOIN actors_meta ON actors_meta.actor_id = actors.id
|
||||
LEFT JOIN actors AS aliases ON aliases.alias_for = actors.id
|
||||
${actorIds ? 'WHERE actors.id = ANY(?)' : ''}
|
||||
GROUP BY actors.id, actors_meta.stashed, actors_meta.scenes
|
||||
`, actorIds && [actorIds]);
|
||||
|
||||
const actorsById = Object.fromEntries(actors.rows.map((actor) => [actor.id, actor]));
|
||||
@@ -408,7 +411,9 @@ export async function syncManticoreActors(actorIds) {
|
||||
index: 'actors',
|
||||
id: actor.id,
|
||||
doc: {
|
||||
entity_id: actor.entity_id,
|
||||
entity_id: actor.entity_id || undefined,
|
||||
alias_for: actor.alias_for || undefined,
|
||||
aliases: actor.alias,
|
||||
name: actor.name,
|
||||
slug: actor.slug,
|
||||
gender: actor.gender || undefined,
|
||||
|
||||
Reference in New Issue
Block a user