Video search -> case insensitive
authorChocobozzz <florian.bigard@gmail.com>
Thu, 6 Jul 2017 16:01:02 +0000 (18:01 +0200)
committerChocobozzz <florian.bigard@gmail.com>
Thu, 6 Jul 2017 16:01:02 +0000 (18:01 +0200)
scripts/dev/server.sh
server/models/video/video.ts

index bff26cb4bbac80a5358b0a73c24336bea129a2d7..3130f1d87254ad9c374b2bb9b14b53ffef0a5958 100755 (executable)
@@ -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
 
index 629051ae46c24af0b3747a897e6014b848f10667..3d71e8d9e6fa2adb24a0a1e60326a22162c49094 100644 (file)
@@ -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,