1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Add search index tests

This commit is contained in:
Chocobozzz 2020-06-10 10:58:44 +02:00 committed by Chocobozzz
parent 3b0bd70aa0
commit 3521ab8fc0
6 changed files with 351 additions and 5 deletions

View file

@ -76,7 +76,7 @@ function searchVideoChannels (req: express.Request, res: express.Response) {
// @username -> username to search in DB
if (query.search.startsWith('@')) query.search = query.search.replace(/^@/, '')
if (isSearchIndexEnabled(query)) {
if (isSearchIndexSearch(query)) {
return searchVideoChannelsIndex(query, res)
}
@ -157,7 +157,7 @@ function searchVideos (req: express.Request, res: express.Response) {
return searchVideoURI(search, res)
}
if (isSearchIndexEnabled(query)) {
if (isSearchIndexSearch(query)) {
return searchVideosIndex(query, res)
}
@ -226,7 +226,7 @@ async function searchVideoURI (url: string, res: express.Response) {
})
}
function isSearchIndexEnabled (query: SearchTargetQuery) {
function isSearchIndexSearch (query: SearchTargetQuery) {
if (query.searchTarget === 'search-index') return true
const searchIndexConfig = CONFIG.SEARCH.SEARCH_INDEX