aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-06 18:01:02 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-06 18:01:02 +0200
commit18c8e945089bff49d2c617c411c8a8f4575989ad (patch)
tree320b3fe134e90edae3e8d835a470001208039ae0 /server/models
parent8b13c289f8db1666a3970882797d42f6cfd6128b (diff)
downloadPeerTube-18c8e945089bff49d2c617c411c8a8f4575989ad.tar.gz
PeerTube-18c8e945089bff49d2c617c411c8a8f4575989ad.tar.zst
PeerTube-18c8e945089bff49d2c617c411c8a8f4575989ad.zip
Video search -> case insensitive
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video.ts12
1 files changed, 4 insertions, 8 deletions
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
730 `(SELECT "VideoTags"."videoId" 730 `(SELECT "VideoTags"."videoId"
731 FROM "Tags" 731 FROM "Tags"
732 INNER JOIN "VideoTags" ON "Tags"."id" = "VideoTags"."tagId" 732 INNER JOIN "VideoTags" ON "Tags"."id" = "VideoTags"."tagId"
733 WHERE name LIKE ${escapedValue} 733 WHERE name ILIKE ${escapedValue}
734 )` 734 )`
735 ) 735 )
736 } else if (field === 'host') { 736 } else if (field === 'host') {
737 // FIXME: Include our pod? (not stored in the database) 737 // FIXME: Include our pod? (not stored in the database)
738 podInclude.where = { 738 podInclude.where = {
739 host: { 739 host: {
740 $like: '%' + value + '%' 740 $iLike: '%' + value + '%'
741 } 741 }
742 } 742 }
743 podInclude.required = true 743 podInclude.required = true
744 } else if (field === 'author') { 744 } else if (field === 'author') {
745 authorInclude.where = { 745 authorInclude.where = {
746 name: { 746 name: {
747 $like: '%' + value + '%' 747 $iLike: '%' + value + '%'
748 } 748 }
749 } 749 }
750 750
751 // authorInclude.or = true 751 // authorInclude.or = true
752 } else { 752 } else {
753 query.where[field] = { 753 query.where[field] = {
754 $like: '%' + value + '%' 754 $iLike: '%' + value + '%'
755 } 755 }
756 } 756 }
757 757
@@ -759,10 +759,6 @@ searchAndPopulateAuthorAndPodAndTags = function (value: string, field: string, s
759 authorInclude, tagInclude 759 authorInclude, tagInclude
760 ] 760 ]
761 761
762 if (tagInclude.where) {
763 // query.include.push([ Video['sequelize'].models.Tag ])
764 }
765
766 return Video.findAndCountAll(query).then(({ rows, count }) => { 762 return Video.findAndCountAll(query).then(({ rows, count }) => {
767 return { 763 return {
768 data: rows, 764 data: rows,