aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/videos.js')
-rw-r--r--server/models/videos.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/server/models/videos.js b/server/models/videos.js
index 9521e63e3..7bd41f7ee 100644
--- a/server/models/videos.js
+++ b/server/models/videos.js
@@ -124,8 +124,15 @@ function removeByIds (ids, callback) {
124 VideosDB.remove({ _id: { $in: ids } }, callback) 124 VideosDB.remove({ _id: { $in: ids } }, callback)
125} 125}
126 126
127function search (name, start, count, sort, callback) { 127function search (value, field, start, count, sort, callback) {
128 const query = { name: new RegExp(name) } 128 const query = {}
129 // Make an exact search with the magnet
130 if (field === 'magnetUri') {
131 query[field] = value
132 } else {
133 query[field] = new RegExp(value)
134 }
135
129 findWithCount(query, start, count, sort, callback) 136 findWithCount(query, start, count, sort, callback)
130} 137}
131 138