1
0
Fork 0

Video search -> case insensitive

This commit is contained in:
Chocobozzz 2017-07-06 18:01:02 +02:00
parent 8b13c289f8
commit 18c8e94508
2 changed files with 6 additions and 10 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/usr/bin/env sh
if [ ! -d "./client/dist" ]; then if [ ! -f "./client/dist/index.html" ]; then
echo "client/dist does not exist, compile client files..." echo "client/dist/index.html does not exist, compile client files..."
npm run build:client npm run build:client
fi fi

View File

@ -730,28 +730,28 @@ searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, s
`(SELECT "VideoTags"."videoId" `(SELECT "VideoTags"."videoId"
FROM "Tags" FROM "Tags"
INNER JOIN "VideoTags" ON "Tags"."id" = "VideoTags"."tagId" INNER JOIN "VideoTags" ON "Tags"."id" = "VideoTags"."tagId"
WHERE name LIKE ${escapedValue} WHERE name ILIKE ${escapedValue}
)` )`
) )
} else if (field === 'host') { } else if (field === 'host') {
// FIXME: Include our pod? (not stored in the database) // FIXME: Include our pod? (not stored in the database)
podInclude.where = { podInclude.where = {
host: { host: {
$like: '%' + value + '%' $iLike: '%' + value + '%'
} }
} }
podInclude.required = true podInclude.required = true
} else if (field === 'author') { } else if (field === 'author') {
authorInclude.where = { authorInclude.where = {
name: { name: {
$like: '%' + value + '%' $iLike: '%' + value + '%'
} }
} }
// authorInclude.or = true // authorInclude.or = true
} else { } else {
query.where[field] = { query.where[field] = {
$like: '%' + value + '%' $iLike: '%' + value + '%'
} }
} }
@ -759,10 +759,6 @@ searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, s
authorInclude, tagInclude authorInclude, tagInclude
] ]
if (tagInclude.where) {
// query.include.push([ Video['sequelize'].models.Tag ])
}
return Video.findAndCountAll(query).then(({ rows, count }) => { return Video.findAndCountAll(query).then(({ rows, count }) => {
return { return {
data: rows, data: rows,