Skip to content

Commit 26c3e00

Browse files
committed
fix(headlines-search): filter only active topics and sources in search
- Add 'status': ContentStatus.active.name filter to topic and source repository calls - Update both readAll method calls for topics and sources - Improve search relevance by excluding inactive content
1 parent 7404421 commit 26c3e00

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/headlines-search/bloc/headlines_search_bloc.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class HeadlinesSearchBloc
161161
);
162162
case ContentType.topic:
163163
response = await _topicRepository.readAll(
164-
filter: {'q': searchTerm},
164+
filter: {'q': searchTerm, 'status': ContentStatus.active.name},
165165
pagination: PaginationOptions(
166166
limit: _limit,
167167
cursor: successState.cursor,
@@ -178,7 +178,7 @@ class HeadlinesSearchBloc
178178
);
179179
case ContentType.source:
180180
response = await _sourceRepository.readAll(
181-
filter: {'q': searchTerm},
181+
filter: {'q': searchTerm, 'status': ContentStatus.active.name},
182182
pagination: PaginationOptions(
183183
limit: _limit,
184184
cursor: successState.cursor,
@@ -266,14 +266,14 @@ class HeadlinesSearchBloc
266266
);
267267
case ContentType.topic:
268268
rawResponse = await _topicRepository.readAll(
269-
filter: {'q': searchTerm},
269+
filter: {'q': searchTerm, 'status': ContentStatus.active.name},
270270
pagination: const PaginationOptions(limit: _limit),
271271
sort: [const SortOption('name', SortOrder.asc)],
272272
);
273273
processedItems = rawResponse.items.cast<FeedItem>();
274274
case ContentType.source:
275275
rawResponse = await _sourceRepository.readAll(
276-
filter: {'q': searchTerm},
276+
filter: {'q': searchTerm, 'status': ContentStatus.active.name},
277277
pagination: const PaginationOptions(limit: _limit),
278278
sort: [const SortOption('name', SortOrder.asc)],
279279
);

0 commit comments

Comments
 (0)