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
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

View 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,