Skip to content

feat(cli): --author and --since filters on buzz messages search#1665

Open
tlongwell-block wants to merge 1 commit into
mainfrom
eva/search-author-filter
Open

feat(cli): --author and --since filters on buzz messages search#1665
tlongwell-block wants to merge 1 commit into
mainfrom
eva/search-author-filter

Conversation

@tlongwell-block

Copy link
Copy Markdown
Collaborator

Implements the buzz-feature-requests ask (Aaron): query all messages by a specific user across channels without an N-channel sweep.

What

buzz messages search gains two flags:

  • --author <pubkey|npub|display-name> — filter by author. Hex and npub are used directly; a display name is resolved via NIP-50 kind:0 search with an exact case-insensitive match on display_name/name. Zero matches or ambiguity (e.g. 100 users named "Fizz") is a clear usage error rather than a silent wrong-author query.
  • --since <unix-ts> — passes through to the relay filter.

--query becomes optional; at least one of --query/--author is required. All flags combine.

# All of Aaron's messages today, across channels
buzz messages search --author Aaron --since 1783497600

# Aaron's messages mentioning "checkout"
buzz messages search --author Aaron --query checkout --limit 20

No relay changes

Both relay paths already honor the standard nostr authors filter field:

  • --author + --query → HTTP bridge FTS path (handle_bridge_search) pushes authors into buzz_search::SearchQuery (bridge.rs).
  • --author alone → general query path (build_event_query_from_filter) uses the authors IN-list pushdown in buzz-db and post-filters channel access as usual.

Author-only results are sorted newest-first client-side (the FTS path returns relevance order; a pure author/time query has none).

Verification

  • cargo test -p buzz-cli — 139 pass, incl. 4 new unit tests pinning the name-resolution semantics (exact-not-substring, case-insensitive, ambiguity, dedup of duplicate kind:0 rows, malformed content).
  • Clippy clean, cargo fmt applied.
  • Live e2e against the staging relay: author-only (hex/npub/name), author+query, --since window bounds respected, and error paths (no flags, unknown name, ambiguous name with capped candidate listing, invalid npub) all verified.

The nice-to-haves from the request (--channel scope, --mentions) are deliberately left out per the "minimal ask" framing — both relay paths already support them if wanted later.

Answers the buzz-feature-requests ask: query all messages by a specific
user across channels without an N-channel sweep. `--author` accepts a
64-char hex pubkey, an npub, or a display name (resolved via NIP-50
kind:0 search; exact case-insensitive match, ambiguity is an error
listing candidates). `--query` becomes optional — at least one of
--query/--author is required. `--since` passes through to the relay
filter on both paths.

No relay changes: the HTTP bridge FTS path already pushes the standard
nostr `authors` filter field into buzz-search, and author-only queries
land on the general query path which honors `authors` via the
EventQuery IN-list pushdown and post-filters channel access.

Author-only results are sorted newest-first client-side (the FTS path
returns relevance order; a pure author/time query has none).

Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant