From 18c8e945089bff49d2c617c411c8a8f4575989ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 6 Jul 2017 18:01:02 +0200 Subject: Video search -> case insensitive --- server/models/video/video.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'server/models') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 629051ae4..3d71e8d9e 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -730,28 +730,28 @@ searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, s `(SELECT "VideoTags"."videoId" FROM "Tags" INNER JOIN "VideoTags" ON "Tags"."id" = "VideoTags"."tagId" - WHERE name LIKE ${escapedValue} + WHERE name ILIKE ${escapedValue} )` ) } else if (field === 'host') { // FIXME: Include our pod? (not stored in the database) podInclude.where = { host: { - $like: '%' + value + '%' + $iLike: '%' + value + '%' } } podInclude.required = true } else if (field === 'author') { authorInclude.where = { name: { - $like: '%' + value + '%' + $iLike: '%' + value + '%' } } // authorInclude.or = true } else { query.where[field] = { - $like: '%' + value + '%' + $iLike: '%' + value + '%' } } @@ -759,10 +759,6 @@ searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, s authorInclude, tagInclude ] - if (tagInclude.where) { - // query.include.push([ Video['sequelize'].models.Tag ]) - } - return Video.findAndCountAll(query).then(({ rows, count }) => { return { data: rows, -- cgit v1.2.3