mirror of
https://github.com/immich-app/immich.git
synced 2026-08-02 00:48:08 -07:00
no smart search cursor
This commit is contained in:
@@ -387,7 +387,6 @@ const SmartSearchSchema = withShapeExclusivity(
|
||||
language: z.string().optional().describe('Search language code'),
|
||||
page: z.int().min(1).optional().describe('Page number').meta(DEPRECATED_FLAT_FIELD),
|
||||
filter: filterField,
|
||||
cursor: cursorField,
|
||||
}).strict(),
|
||||
).meta({ id: 'SmartSearchDto' });
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ describe(SearchService.name, () => {
|
||||
mocks.machineLearning.encodeText.mockResolvedValue('[1, 2, 3]');
|
||||
await sut.searchSmart(auth, { size: 100, filter: {}, query: 'test' });
|
||||
expect(mocks.search.searchSmartV3).toHaveBeenCalledWith(
|
||||
{ size: 100, offset: 0 },
|
||||
{ size: 100 },
|
||||
expect.objectContaining({ embedding: '[1, 2, 3]' }),
|
||||
expect.objectContaining({ lockedOwnerId: expect.any(String) }),
|
||||
);
|
||||
|
||||
@@ -285,15 +285,14 @@ export class SearchService extends BaseService {
|
||||
this.resolveEmbedding(auth, dto, machineLearning),
|
||||
]);
|
||||
|
||||
const { offset } = decodeSearchCursor(dto.cursor);
|
||||
const size = dto.size;
|
||||
const { hasNextPage, items } = await this.searchRepository.searchSmartV3(
|
||||
{ size, offset },
|
||||
// no cursor until a rank-aware pagination strategy for smart search is decided
|
||||
const { items } = await this.searchRepository.searchSmartV3(
|
||||
{ size: dto.size },
|
||||
{ filter, withExif: dto.withExif, embedding },
|
||||
scope,
|
||||
);
|
||||
|
||||
return this.mapResponse(items, { auth }, { nextCursor: hasNextPage ? encodeSearchCursor(offset + size) : null });
|
||||
return this.mapResponse(items, { auth });
|
||||
}
|
||||
|
||||
private async resolveSearchScopeV3(
|
||||
|
||||
Reference in New Issue
Block a user