From bbaaf28d2e3128880bcc1ca6f7840472c493b7eb Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Wed, 25 Feb 2026 20:35:08 -0800 Subject: [PATCH] fix(x): don't skip unfiltered resolved handle search when entity-extracted The resolved handle dedup was wrong: if entity_extract found @thedorbrothers (from @mentions in Phase 1 results), the resolved handle search was skipped entirely. But entity-extracted handles are searched WITH topic keywords (from:handle topic), while resolved handles need UNFILTERED search (from:handle) to find posts that don't mention the topic string. Example: Dor Brothers' viral tweet (5.5K likes) says "We made a $300M movie starring @LoganPaul" - no mention of "dor brothers" anywhere. The topic- filtered entity search missed it. The unfiltered resolved search finds it. Before: 30 X posts, 161+ likes (entity search only) After: 40 X posts, 5549+ likes (resolved handle adds viral tweet) Co-Authored-By: Claude Opus 4.6 --- scripts/last30days.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/last30days.py b/scripts/last30days.py index b12e0c3..1517417 100644 --- a/scripts/last30days.py +++ b/scripts/last30days.py @@ -436,12 +436,12 @@ def _run_supplemental( has_handles = entities["x_handles"] and x_source == "bird" has_subs = entities["reddit_subreddits"] and not skip_reddit - # Check if resolved handle is new (not already in extracted entities) - has_resolved = ( - resolved_handle - and x_source == "bird" - and resolved_handle.lower() not in {h.lower() for h in entities["x_handles"]} - ) + # Always run unfiltered search for resolved handle (even if entity-extracted). + # Entity-extracted handles get topic-filtered queries (from:handle topic), + # but resolved handles need UNFILTERED search (from:handle) to find posts + # that don't mention the topic string (e.g. Dor Brothers' viral tweet about + # Logan Paul doesn't contain "dor brothers" in the text). + has_resolved = bool(resolved_handle) and x_source == "bird" if not has_handles and not has_subs and not has_resolved: return [], [] @@ -471,7 +471,7 @@ def _run_supplemental( x_future = None resolved_future = None - max_workers = sum([has_subs, has_handles, has_resolved]) + max_workers = sum([bool(has_subs), bool(has_handles), bool(has_resolved)]) with ThreadPoolExecutor(max_workers=max(max_workers, 1)) as executor: if has_subs: reddit_future = executor.submit(