From 3e0c9ff5d5d2a2435fcc25deac3a98223aa7c225 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 27 Mar 2018 15:09:53 +0200 Subject: Add ability to search on domain and username too --- server/models/video/video.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 3611eca89..a28b5209b 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -676,9 +676,23 @@ export class VideoModel extends Model { limit: count, order: getSort(sort), where: { - name: { - [Sequelize.Op.iLike]: '%' + value + '%' - } + [Sequelize.Op.or]: [ + { + name: { + [ Sequelize.Op.iLike ]: '%' + value + '%' + } + }, + { + preferredUsername: Sequelize.where(Sequelize.col('preferredUsername'), { + [ Sequelize.Op.iLike ]: '%' + value + '%' + }) + }, + { + host: Sequelize.where(Sequelize.col('host'), { + [ Sequelize.Op.iLike ]: '%' + value + '%' + }) + } + ] } } -- cgit v1.2.3