feat(server, web): smart search filtering and pagination (#6525)

* initial pagination impl

* use limit + offset instead of take + skip

* wip web pagination

* working infinite scroll

* update api

* formatting

* fix rebase

* search refactor

* re-add runtime config for vector search

* fix rebase

* fixes

* useless omitBy

* unnecessary handling

* add sql decorator for `searchAssets`

* fixed search builder

* fixed sql

* remove mock method

* linting

* fixed pagination

* fixed unit tests

* formatting

* fix e2e tests

* re-flatten search builder

* refactor endpoints

* clean up dto

* refinements

* don't break everything just yet

* update openapi spec & sql

* update api

* linting

* update sql

* fixes

* optimize web code

* fix typing

* add page limit

* make limit based on asset count

* increase limit

* simpler import
This commit is contained in:
Mert 2024-02-12 20:50:47 -05:00 committed by GitHub
parent f1e4fdf175
commit e334443919
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 3993 additions and 790 deletions

View file

@ -16,6 +16,7 @@ class SearchAssetResponseDto {
required this.count,
this.facets = const [],
this.items = const [],
required this.nextPage,
required this.total,
});
@ -25,6 +26,8 @@ class SearchAssetResponseDto {
List<AssetResponseDto> items;
String? nextPage;
int total;
@override
@ -32,6 +35,7 @@ class SearchAssetResponseDto {
other.count == count &&
_deepEquality.equals(other.facets, facets) &&
_deepEquality.equals(other.items, items) &&
other.nextPage == nextPage &&
other.total == total;
@override
@ -40,16 +44,22 @@ class SearchAssetResponseDto {
(count.hashCode) +
(facets.hashCode) +
(items.hashCode) +
(nextPage == null ? 0 : nextPage!.hashCode) +
(total.hashCode);
@override
String toString() => 'SearchAssetResponseDto[count=$count, facets=$facets, items=$items, total=$total]';
String toString() => 'SearchAssetResponseDto[count=$count, facets=$facets, items=$items, nextPage=$nextPage, total=$total]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'count'] = this.count;
json[r'facets'] = this.facets;
json[r'items'] = this.items;
if (this.nextPage != null) {
json[r'nextPage'] = this.nextPage;
} else {
// json[r'nextPage'] = null;
}
json[r'total'] = this.total;
return json;
}
@ -65,6 +75,7 @@ class SearchAssetResponseDto {
count: mapValueOfType<int>(json, r'count')!,
facets: SearchFacetResponseDto.listFromJson(json[r'facets']),
items: AssetResponseDto.listFromJson(json[r'items']),
nextPage: mapValueOfType<String>(json, r'nextPage'),
total: mapValueOfType<int>(json, r'total')!,
);
}
@ -116,6 +127,7 @@ class SearchAssetResponseDto {
'count',
'facets',
'items',
'nextPage',
'total',
};
}