NIP-91: AND operator for filters - #2252
Conversation
|
should I merge this again 😂 |
Wait!!! We need to mindlessly debate until everybody gets tired and implement the original concept anyway. |
|
I don't have anything to debate, but I felt it was necessary to open another PR because the old one was "merged" and the changes were reverted So this is a second attempt to merge this NIP or at least continue whatever conversation was happening and tracking implementations |
makes NIP-91 bidirectionally compatible and non-breaking
Co-authored-by: arthurfranca <arthur.a.franca@gmail.com>
Add support for the AND operator in REQ filters as proposed in nostr-protocol/nips#2252 (NIP-91 / NIP-119). Filter keys prefixed with "&" require every listed value to be present on a tag of that name, complementing the existing "#"-prefixed OR semantics.
|
I support this proposal like last time, mostly. There seems to be no good reason to object this, and it is backwards compatible by just coying
Replace this with one
is zero as the different number of tags doesn't matter, only total conditions to check. FYI: Nostr.land is going to implement next release, as stated in last discussion, not sure why it got marked as implemented yet. |
|
This was already implemented in nostr-rs-relay, but is now in the 0.10.0 release. |
|
Any update on this ? |
|
We need to merge. There is already too much support for this not to be "official". |
|
What client specifically needs this? |
|
@alexgleason There are clients listed in the PR body. TLDR: NIP-91 allows relays to give the client the needle it is looking for instead of arbitrarily limiting the protocol so that a relay must return an entire haystack Recap for anyone watching
Summary
|
|
I understand what problems it solves technically. We need to start thinking about Nostr from a product standpoint. I want to know what amazing projects people are actively working on that are blocked by not having this. Knowing that will help me justify why I should be upgrading my relay and all my tooling right now. |
|
It’s hard to quantify what’s blocked because the missing functionality discourages people from exploring the use cases in the first place. Practical Examples of where it is needed:
IMO the real question is: What innovations are we arbitrarily discouraging from existing? Once developers realize this basic operation isn’t available, they either settle for local intersection, which will still happen with NIP-91, or abandon the idea entirely. NIP-91 moves us toward optimizing this case. It likely enables richer meta-driven interactions while reducing bandwidth, battery use, relay CPU time, and client complexity. Every single one of those benefits mentioned are upstream from any product discussion and therefor could have a direct effect on the resulting product. |
Add support for the AND operator in REQ filters as proposed in nostr-protocol/nips#2252 (NIP-91 / NIP-119). Filter keys prefixed with "&" require every listed value to be present on a tag of that name, complementing the existing "#"-prefixed OR semantics.
Add support for the AND operator in REQ filters as proposed in nostr-protocol/nips#2252 (NIP-91 / NIP-119). Filter keys prefixed with "&" require every listed value to be present on a tag of that name, complementing the existing "#"-prefixed OR semantics.
Duplicate PR
This PR is a clone of PR #1365 in order to reopen that PR and continue the discussion and tracking of implementations.
Filter operand that has optimization benefits for relays, users and developers. Likely contentious.
This NIP is the result of convergent efforts. I wrote this NIP because it seemed obvious but didn't submit because I didn't have an implementation, @v0l wrote an implementation(*) around the same time. @lez connected the dots.
Rendered NIP
Discourse
Implementations
pending
Rationale
meme AND catobjectively consumes less bandwidth thanmeme OR catANDis fast for all common index formats, and faster compared toORfor some index formats. (See section below)Considerations
NIP-11.limitations:max_tags_per_andandmax_tags_andIndex Efficiency