From 18c8e945089bff49d2c617c411c8a8f4575989ad Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 6 Jul 2017 18:01:02 +0200 Subject: [PATCH] Video search -> case insensitive --- scripts/dev/server.sh | 4 ++-- server/models/video/video.ts | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/dev/server.sh b/scripts/dev/server.sh index bff26cb4b..3130f1d87 100755 --- a/scripts/dev/server.sh +++ b/scripts/dev/server.sh @@ -1,7 +1,7 @@ #!/usr/bin/env sh -if [ ! -d "./client/dist" ]; then - echo "client/dist does not exist, compile client files..." +if [ ! -f "./client/dist/index.html" ]; then + echo "client/dist/index.html does not exist, compile client files..." npm run build:client fi 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,