Skip to content

Commit 38cda9d

Browse files
committed
fix(headlines-search): enhance country search with pagination and filtering
- Add 'usage' filter to only include countries with active headlines - Implement pagination to limit search results to a maximum number - Update search logic to use the new filter and pagination options
1 parent 4c4ac3d commit 38cda9d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/headlines-search/bloc/headlines_search_bloc.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ class HeadlinesSearchBloc
175175
);
176176
case ContentType.country:
177177
response = await _countryRepository.readAll(
178-
filter: {'q': searchTerm},
178+
filter: {'q': searchTerm, 'usage': 'hasActiveHeadlines'},
179+
pagination: const PaginationOptions(limit: _limit),
179180
sort: [const SortOption('name', SortOrder.asc)],
180181
);
181182
emit(
@@ -260,7 +261,8 @@ class HeadlinesSearchBloc
260261
processedItems = rawResponse.items.cast<FeedItem>();
261262
case ContentType.country:
262263
rawResponse = await _countryRepository.readAll(
263-
filter: {'q': searchTerm},
264+
filter: {'q': searchTerm, 'usage': 'hasActiveHeadlines'},
265+
pagination: const PaginationOptions(limit: _limit),
264266
sort: [const SortOption('name', SortOrder.asc)],
265267
);
266268
processedItems = rawResponse.items.cast<FeedItem>();

0 commit comments

Comments
 (0)