strfry icon indicating copy to clipboard operation
strfry copied to clipboard

Search by tag and tag substring returns no results

Open mrkvon opened this issue 1 year ago • 2 comments

Hello!

Bug

When I send REQ with #t: ['photography'], I receive plenty of results. But if I send #t: ['photography', 'photogr'], the results are empty. For some reason, the unmatched substring tag cancels matched full tag.

Sending REQ #t: ['photo', 'photography'] returns results with photo tag, results with both tags, but doesn't return results with photography only.

The same happened with #g tag (geohash).

Expected results

When I send REQ with #t: ['photography', 'photogr'], I would expect to receive events with ['t': 'photography'] tag.

Context

I tested and reproduced this issue against relays wss://relay.damus.io, wss://nostr.wine, wss://relayable.org with issues. Tested against wss://lightningrelay.com which uses different software, without issues.

It looks like the issue is with this software, but I'm not sure.

Used nostr-tools to send the requests.

Thank you!

mrkvon avatar May 17 '24 06:05 mrkvon

Yeah I'm pretty sure this is a bug, thanks for reporting! I think I know the problem and I'll try to fix it for next release.

hoytech avatar Jul 19 '24 04:07 hoytech

I fixed this in the following commit which will be included in the next major strfry release (1.0 series).

https://github.com/hoytech/strfry/commit/77b208e837eccfadb43a4e5863745bf5f4dbf81f

The bug was an error in an optimisation related to the prefix matching of ids/authors filters which incorrectly applied to tags as well. I rolled the fix into a big refactor where prefix matching was removed altogether (since this feature was also removed from NIP-01).

hoytech avatar Aug 30 '24 20:08 hoytech