Skip to content

feat: Add NIP-50 full-text search support#587

Closed
Anshumancanrock wants to merge 1 commit intocameri:mainfrom
Anshumancanrock:feat/nip-50-search
Closed

feat: Add NIP-50 full-text search support#587
Anshumancanrock wants to merge 1 commit intocameri:mainfrom
Anshumancanrock:feat/nip-50-search

Conversation

@Anshumancanrock
Copy link
Copy Markdown
Collaborator

Adds search filter support to REQ messages using PostgreSQL full-text search. Disabled by default.

["REQ", "sub1", {"search": "bitcoin lightning", "kinds": [1], "limit": 20}]

What this does

  • Accepts search in REQ filters, validated via Zod schema
  • Queries events using to_tsvector/plainto_tsquery with a GIN index
  • Ranks results by ts_rank instead of created_at
  • Matches live subscriptions in-memory (case-insensitive term matching)
  • Strips search from filters when disabled (per spec: silently ignore)
  • Advertises search_supported in the NIP-11 document
  • Migration adds the GIN index via CREATE INDEX CONCURRENTLY

Configuration

nip50:
  enabled: false
  language: simple       # or 'english', 'spanish', etc.
  maxQueryLength: 256

Tests

  • Unit: schema validation, in-memory matching, NIP-11, repository queries
  • Integration: search match, no-match, combined with kind filter

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 27, 2026

🦋 Changeset detected

Latest commit: ea52a30

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coveralls
Copy link
Copy Markdown
Collaborator

coveralls commented Apr 27, 2026

Coverage Status

coverage: 64.212% (+0.2%) from 64.015% — Anshumancanrock:feat/nip-50-search into cameri:main

@Anshumancanrock Anshumancanrock requested a review from cameri April 27, 2026 18:15
@Anshumancanrock Anshumancanrock marked this pull request as draft April 27, 2026 18:20
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.

2 participants