From 57c36b277e68b764dd34cb2e449f6e2ca3d1e9b6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 19 Jul 2018 16:17:54 +0200 Subject: Begin advanced search --- server/middlewares/sort.ts | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'server/middlewares/sort.ts') diff --git a/server/middlewares/sort.ts b/server/middlewares/sort.ts index cdb809e75..6307ee154 100644 --- a/server/middlewares/sort.ts +++ b/server/middlewares/sort.ts @@ -8,6 +8,12 @@ function setDefaultSort (req: express.Request, res: express.Response, next: expr return next() } +function setDefaultSearchSort (req: express.Request, res: express.Response, next: express.NextFunction) { + if (!req.query.sort) req.query.sort = '-bestmatch' + + return next() +} + function setBlacklistSort (req: express.Request, res: express.Response, next: express.NextFunction) { let newSort: SortType = { sortModel: undefined, sortValue: undefined } @@ -33,5 +39,6 @@ function setBlacklistSort (req: express.Request, res: express.Response, next: ex export { setDefaultSort, + setDefaultSearchSort, setBlacklistSort } -- cgit v1.2.3