Skip to content

Extension-only queries (e.g. language:bg) return no results #130

@alltheseas

Description

@alltheseas

Bug

Searching with only NIP-50 extensions like language:bg (no base search term) returns no results.

Steps to reproduce

  1. Search: language:bg
  2. Expected: Bulgarian-language notes
  3. Actual: No results in Bg / results in e.g. English

Root cause

The query parsing pipeline extracts NIP-50 extensions (language:bg) from the query string, leaving an empty cleaned string. The empty string is falsy, so the search field is never set on the filter — the extensions are silently dropped.

Flow:

  1. extractNip50Extensions("language:bg"){ cleaned: "", extensions: { language: "bg" } }
  2. cleaned is empty → falsy → search field omitted from filter
  3. buildSearchQueryWithExtensions("", { language: "bg" }) would produce "language:bg" but is never called

Fix

buildSearchQueryWithExtensions already handles empty base queries correctly (returns "language:bg"). The call site needs to pass "" instead of skipping when the base query is empty:

const searchQuery = buildSearchQueryWithExtensions(baseSearch || '', nip50Extensions) || undefined;

Note: This is already fixed on the perf/fixes-with-benchmarks branch (commit f640633).

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