Skip to content

Multi by: query mangles second author token #128

@alltheseas

Description

@alltheseas

Bug

tryHandleAuthorSearch in src/lib/search/strategies/authorSearchStrategy.ts:26 uses a non-global regex to extract only the first by: token. The replacement at line 33 consumes surrounding whitespace, causing the second by: token to be concatenated with the preceding text.

Steps to reproduce

Search for: bitcoin by:dergigi by:odell

Expected

Results from both dergigi and odell containing "bitcoin".

Actual

Console error: BUG: No filters to merge! {}
No results returned.

Root cause

// Line 26 — only matches FIRST by: token
const authorMatch = cleanedQuery.match(/(?:^|\s)by:(\S+)(?:\s|$)/i);
// Line 33 — replacement eats surrounding spaces, mangling the rest
const terms = cleanedQuery.replace(/(?:^|\s)by:(\S+)(?:\s|$)/i, '').trim();

For bitcoin by:dergigi by:odell:

  • author = dergigi (only the first)
  • terms = bitcoinby:odell (space between "bitcoin" and "by:odell" was consumed by the regex)

Suggested fix

Extract all by: tokens with a global regex, resolve them in parallel, and strip them cleanly from the residual search text.

Tracked as ants-h9w.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions