diff --git a/front_end/src/app/(main)/questions/helpers/filters.ts b/front_end/src/app/(main)/questions/helpers/filters.ts index 86f0082844..f6e816e52f 100644 --- a/front_end/src/app/(main)/questions/helpers/filters.ts +++ b/front_end/src/app/(main)/questions/helpers/filters.ts @@ -86,7 +86,6 @@ const EXPLICIT_FEED_FILTER_KEYS = [ POST_NOT_FORECASTER_ID_FILTER, POST_PROJECT_FILTER, POST_STATUS_FILTER, - POST_TEXT_SEARCH_FILTER, POST_TOPIC_FILTER, POST_TYPE_FILTER, POST_UPVOTED_BY_FILTER, diff --git a/posts/services/feed.py b/posts/services/feed.py index 120cf61146..113f924bdd 100644 --- a/posts/services/feed.py +++ b/posts/services/feed.py @@ -70,7 +70,9 @@ def get_posts_feed( # noqa: C901 # Apply consumer views filter if for_consumer_view: - qs = filter_for_consumer_view(qs) + # When the user is searching, keep resolved posts in the result set so + # they can still find questions by title regardless of resolution state. + qs = filter_for_consumer_view(qs, include_resolved=bool(search)) # Exclude Deleted posts qs = qs.exclude(curation_status=Post.CurationStatus.DELETED) @@ -333,7 +335,9 @@ def get_posts_feed( # noqa: C901 return qs.distinct("id", order_type).only("pk") -def filter_for_consumer_view(qs: QuerySet[Post]) -> QuerySet[Post]: +def filter_for_consumer_view( + qs: QuerySet[Post], include_resolved: bool = False +) -> QuerySet[Post]: """ A special filter applied to default Consumer View feed representation https://github.com/Metaculus/metaculus/issues/3377 @@ -370,8 +374,17 @@ def filter_for_consumer_view(qs: QuerySet[Post]) -> QuerySet[Post]: ) ) - # Exclude resolved questions - qs = qs.exclude(resolved=True) + # Exclude resolved questions (unless the caller explicitly wants them, e.g. + # for search results where the user is looking up a specific question). + if not include_resolved: + qs = qs.exclude(resolved=True) + + # Exclude AIB / bots-only tournaments — the same questions are typically + # cross-posted in a human-facing project (Metaculus Cup etc.), so showing + # them here produces duplicate-looking search results. + qs = qs.exclude( + default_project__bot_leaderboard_status=Project.BotLeaderboardStatus.BOTS_ONLY + ) return qs