Rework search paging based on cursors

Signed-off-by: Oliver Sand <oliver.sand@sda-se.com>
This commit is contained in:
Oliver Sand
2021-08-19 17:57:11 +02:00
parent a13f21cdc9
commit 532b4cc656
30 changed files with 826 additions and 418 deletions
+5 -9
View File
@@ -36,21 +36,17 @@ export async function createRouter({
req: express.Request<any, unknown, unknown, SearchQuery>,
res: express.Response<SearchResultSet>,
) => {
const { term, filters = {}, types, offset, limit } = req.query;
const { term, filters = {}, types, pageCursor } = req.query;
logger.info(
`Search request received: term="${term}", filters=${JSON.stringify(
filters,
)}, offset=${offset ?? ''}, limit=${limit ?? ''}`,
)}, types=${types ? types.join(',') : ''}, pageCursor=${
pageCursor ?? ''
}`,
);
try {
const results = await engine?.query({
term,
types,
filters,
offset: offset ? Number(offset) : undefined,
limit: limit ? Number(limit) : undefined,
});
const results = await engine?.query(req.query);
res.send(results);
} catch (err) {
throw new Error(