diff --git a/src/handlers/graphql/search.ts b/src/handlers/graphql/search.ts index 6728747d6..8f8f1f756 100644 --- a/src/handlers/graphql/search.ts +++ b/src/handlers/graphql/search.ts @@ -108,8 +108,7 @@ export default async function search(q: any, args: Args, context: Scope) { edges, pageInfo: { hasNextPage: opts.sort === "asc" && totalCount > results.events.length, - hasPreviousPage: - opts.sort === "desc" && totalCount > results.events.length, + hasPreviousPage: opts.sort === "desc" && totalCount > results.events.length, }, }; } diff --git a/src/models/event/filter.ts b/src/models/event/filter.ts index 615fcae7a..9b2c96fce 100644 --- a/src/models/event/filter.ts +++ b/src/models/event/filter.ts @@ -56,9 +56,7 @@ export default async function filter(opts: Options): Promise { SELECT doc FROM indexed_events WHERE ${wheres.join(" AND ")} - ORDER BY (doc-> 'canonical_time')::text::bigint ${_.toUpper( - opts.sort - )}, id ${_.toUpper(opts.sort)} + ORDER BY (doc-> 'canonical_time')::text::bigint ${_.toUpper(opts.sort)}, id ${_.toUpper(opts.sort)} LIMIT ${size}`; const results = await pgPool.query(q, vals); @@ -73,7 +71,7 @@ export default async function filter(opts: Options): Promise { return { events, - totalHits, + totalHits: { value: totalHits }, }; }