Skip to content

Commit b363746

Browse files
committed
graphql-compose#96: check if ES7+ for hits count
1 parent 8c93841 commit b363746

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/resolvers/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export default function createSearchResolver<TSource, TContext>(
177177

178178
const res: any = await searchFC.resolve(rp.source, args, rp.context, rp.info);
179179

180-
res.count = res.hits.total;
180+
res.count = typeof(res.hits.total?.value) === "number" ? res.hits.total.value ? res.hits.total;
181181
res.max_score = res.hits.max_score;
182182
res.hits = res.hits.hits;
183183

0 commit comments

Comments
 (0)