mm-share-lib 0.0.25 → 0.0.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -103,15 +103,17 @@ export abstract class ClientService<
|
|
103
103
|
searchParameters: SearchParams,
|
104
104
|
options: SearchOptions,
|
105
105
|
) => {
|
106
|
-
|
106
|
+
const per_page = searchParameters.per_page ?? 250;
|
107
|
+
searchParameters.per_page = per_page;
|
107
108
|
options.cacheSearchResultsForSeconds = 1;
|
108
109
|
const response = await this.searchDocument(searchParameters, options);
|
109
110
|
const { hits = [], found = 0, page = 1 } = { ...response };
|
110
|
-
|
111
|
-
const hasNext =
|
111
|
+
const documents = hits;
|
112
|
+
const hasNext = per_page * page < found;
|
112
113
|
if (hasNext) {
|
113
114
|
searchParameters.page = page + 1;
|
114
|
-
|
115
|
+
const nextDocuments = await this.getAllRawDocs(searchParameters, options);
|
116
|
+
documents.push(...nextDocuments);
|
115
117
|
}
|
116
118
|
return documents;
|
117
119
|
};
|