mm-share-lib 0.0.23 → 0.0.25
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/dist/src/lib/search-engine/typesense/service/client.service.d.ts +3 -2
- package/dist/src/lib/search-engine/typesense/service/client.service.js +7 -6
- package/dist/src/lib/search-engine/typesense/service/client.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/lib/search-engine/typesense/service/client.service.ts +8 -3
package/package.json
CHANGED
@@ -13,6 +13,7 @@ import { BaseDocument } from '../../document';
|
|
13
13
|
import { SearchDocumentService } from '../../interface';
|
14
14
|
import { EntityGeneric } from '../../../../generic';
|
15
15
|
import { PaginationResponse } from '../../../../response';
|
16
|
+
import { BaseFilterDto } from '../../../../dto';
|
16
17
|
|
17
18
|
export abstract class ClientService<
|
18
19
|
Document extends BaseDocument,
|
@@ -41,11 +42,13 @@ export abstract class ClientService<
|
|
41
42
|
async searchDocument(
|
42
43
|
searchParameters: SearchParams,
|
43
44
|
options: SearchOptions,
|
45
|
+
filter?: BaseFilterDto,
|
44
46
|
): Promise<SearchResponse<any>> {
|
45
47
|
return this.searchDocumentByCollection(
|
46
48
|
this.getCollectionName(),
|
47
49
|
searchParameters,
|
48
50
|
options,
|
51
|
+
filter,
|
49
52
|
);
|
50
53
|
}
|
51
54
|
|
@@ -53,10 +56,12 @@ export abstract class ClientService<
|
|
53
56
|
collection: string,
|
54
57
|
searchParameters: SearchParams,
|
55
58
|
options: SearchOptions,
|
59
|
+
filter?: BaseFilterDto,
|
56
60
|
): Promise<SearchResponse<any>> {
|
57
61
|
try {
|
58
|
-
const {
|
62
|
+
const { per_page = 25 } = { ...searchParameters };
|
59
63
|
const includeDocuments = [];
|
64
|
+
const includeIds = filter?.includeIds || [];
|
60
65
|
|
61
66
|
if (includeIds.length > 0) {
|
62
67
|
const includeOpts = {
|
@@ -101,9 +106,9 @@ export abstract class ClientService<
|
|
101
106
|
searchParameters.per_page = searchParameters.per_page ?? 250;
|
102
107
|
options.cacheSearchResultsForSeconds = 1;
|
103
108
|
const response = await this.searchDocument(searchParameters, options);
|
104
|
-
const { hits = [], found = 0, page = 1 } = response;
|
109
|
+
const { hits = [], found = 0, page = 1 } = { ...response };
|
105
110
|
let documents = hits;
|
106
|
-
const hasNext = hits
|
111
|
+
const hasNext = hits?.length * page < found;
|
107
112
|
if (hasNext) {
|
108
113
|
searchParameters.page = page + 1;
|
109
114
|
documents = await this.getAllRawDocs(searchParameters, options);
|