Added alias to entity search query.
This commit is contained in:
parent
8e7b944b52
commit
60eb599416
|
@ -174,9 +174,9 @@ async function fetchEntities(type, limit) {
|
|||
}
|
||||
|
||||
async function searchEntities(query, type, limit) {
|
||||
const entities = knex
|
||||
const entities = await knex
|
||||
.select(knex.raw(`
|
||||
entities.id, entities.name, entities.slug, entities.type, entities.url, entities.description,
|
||||
entities.id, entities.name, entities.slug, entities.type, entities.url, entities.description, entities.alias,
|
||||
COALESCE(json_agg(tags) FILTER (WHERE tags.id IS NOT NULL), '[]') as tags,
|
||||
row_to_json(parents) as parent
|
||||
`))
|
||||
|
@ -189,10 +189,10 @@ async function searchEntities(query, type, limit) {
|
|||
.leftJoin('entities as parents', 'parents.id', 'entities.parent_id')
|
||||
.leftJoin('entities_tags', 'entities_tags.entity_id', 'entities.id')
|
||||
.leftJoin('tags', 'tags.id', 'entities_tags.tag_id')
|
||||
.groupBy('entities.id', 'entities.name', 'entities.slug', 'entities.type', 'entities.url', 'entities.description', 'parents.id')
|
||||
.groupBy('entities.id', 'entities.name', 'entities.slug', 'entities.type', 'entities.url', 'entities.description', 'entities.alias', 'parents.id')
|
||||
.limit(limit || 100);
|
||||
|
||||
return curateEntities(await entities);
|
||||
return curateEntities(entities);
|
||||
}
|
||||
|
||||
async function flushEntities(networkSlugs = [], channelSlugs = []) {
|
||||
|
|
Loading…
Reference in New Issue