aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-06-10 10:58:44 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-06-10 14:02:41 +0200
commit3521ab8fc01da85fa804439ca6e297e6fb364c58 (patch)
tree70db4fc628c85d145d59efafbefec9093e9eebac /server/controllers
parent3b0bd70aa05ab82fa30fe67ed4899d44652c703a (diff)
downloadPeerTube-3521ab8fc01da85fa804439ca6e297e6fb364c58.tar.gz
PeerTube-3521ab8fc01da85fa804439ca6e297e6fb364c58.tar.zst
PeerTube-3521ab8fc01da85fa804439ca6e297e6fb364c58.zip
Add search index tests
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/config.ts2
-rw-r--r--server/controllers/api/search.ts6
2 files changed, 4 insertions, 4 deletions
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 1d48b4b26..b80ea4902 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -463,7 +463,7 @@ function customConfig (): CustomConfig {
463 disableLocalSearch: CONFIG.SEARCH.SEARCH_INDEX.DISABLE_LOCAL_SEARCH, 463 disableLocalSearch: CONFIG.SEARCH.SEARCH_INDEX.DISABLE_LOCAL_SEARCH,
464 isDefaultSearch: CONFIG.SEARCH.SEARCH_INDEX.IS_DEFAULT_SEARCH 464 isDefaultSearch: CONFIG.SEARCH.SEARCH_INDEX.IS_DEFAULT_SEARCH
465 } 465 }
466 }, 466 }
467 } 467 }
468} 468}
469 469
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts
index e08e1d79f..1dea77d29 100644
--- a/server/controllers/api/search.ts
+++ b/server/controllers/api/search.ts
@@ -76,7 +76,7 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
76 // @username -> username to search in DB 76 // @username -> username to search in DB
77 if (query.search.startsWith('@')) query.search = query.search.replace(/^@/, '') 77 if (query.search.startsWith('@')) query.search = query.search.replace(/^@/, '')
78 78
79 if (isSearchIndexEnabled(query)) { 79 if (isSearchIndexSearch(query)) {
80 return searchVideoChannelsIndex(query, res) 80 return searchVideoChannelsIndex(query, res)
81 } 81 }
82 82
@@ -157,7 +157,7 @@ function searchVideos (req: express.Request, res: express.Response) {
157 return searchVideoURI(search, res) 157 return searchVideoURI(search, res)
158 } 158 }
159 159
160 if (isSearchIndexEnabled(query)) { 160 if (isSearchIndexSearch(query)) {
161 return searchVideosIndex(query, res) 161 return searchVideosIndex(query, res)
162 } 162 }
163 163
@@ -226,7 +226,7 @@ async function searchVideoURI (url: string, res: express.Response) {
226 }) 226 })
227} 227}
228 228
229function isSearchIndexEnabled (query: SearchTargetQuery) { 229function isSearchIndexSearch (query: SearchTargetQuery) {
230 if (query.searchTarget === 'search-index') return true 230 if (query.searchTarget === 'search-index') return true
231 231
232 const searchIndexConfig = CONFIG.SEARCH.SEARCH_INDEX 232 const searchIndexConfig = CONFIG.SEARCH.SEARCH_INDEX