fix: UI fixes + search crash (#1086)

This commit is contained in:
NGPixel
2019-11-02 16:04:43 -04:00
parent 57f79c19b2
commit d69dde1df5
9 changed files with 55 additions and 54 deletions

View File

@@ -32,22 +32,12 @@ module.exports = {
}
// TODO: Add user permissions filtering
builder.andWhere(builderSub => {
switch (WIKI.config.db.type) {
case 'postgres':
builderSub.where('title', 'ILIKE', `%${q}%`)
builderSub.orWhere('description', 'ILIKE', `%${q}%`)
break
case 'mysql':
case 'mariadb':
builderSub.whereRaw(`title LIKE '%?%' COLLATE utf8_general_ci`, [q])
builderSub.orWhereRaw(`description LIKE '%?%' COLLATE utf8_general_ci`, [q])
break
// TODO: MSSQL handling
default:
builderSub.where('title', 'LIKE', `%${q}%`)
builderSub.orWhere('description', 'LIKE', `%${q}%`)
break
if (WIKI.config.db.type === 'postgres') {
builderSub.where('title', 'ILIKE', `%${q}%`)
builderSub.orWhere('description', 'ILIKE', `%${q}%`)
} else {
builderSub.where('title', 'LIKE', `%${q}%`)
builderSub.orWhere('description', 'LIKE', `%${q}%`)
}
})
})