Переглянути джерело

RHL-024 feat(search): add total count to results in FS and Qsirch providers

Code_Uwe 3 тижнів тому
батько
коміт
19503f68a9
2 змінених файлів з 6 додано та 2 видалено
  1. 1 1
      lib/search/providers/fs.js
  2. 5 1
      lib/search/providers/qsirch.js

+ 1 - 1
lib/search/providers/fs.js

@@ -240,7 +240,7 @@ export function createFsProvider() {
 					? encodeCursor({ v: 1, mode: "sync", offset: nextOffset })
 					: null;
 
-			return { items: page, nextCursor };
+			return { items: page, nextCursor, total: results.length };
 		},
 	};
 }

+ 5 - 1
lib/search/providers/qsirch.js

@@ -362,7 +362,11 @@ export function createQsirchProvider({
 				? encodeCursor({ v: 1, mode: "sync", offset: offset + rawCount })
 				: null;
 
-			return { items, nextCursor };
+			return {
+				items,
+				nextCursor,
+				total: Number.isFinite(total) ? total : null,
+			};
 		},
 	};
 }