nostr-protocol / nips

Nostr Implementation Possibilities
2.19k stars 518 forks source link

AND Filters #1291

Open dskvr opened 4 weeks ago

dskvr commented 4 weeks ago

There have been a number of discussions about this topic, and it's even been implemented in a PR to nostr-rs-relay. I published a gist 3 months ago with the hopes someone would pick up where I left off, but nobody has.

tldr

filters: {
  "kinds": [1],
  "&t": ["meme", "cat"],
  "#t": ["black", "white"]
}
// returns kind `1` events with `t` tags that have both "meme" and "cat" that have the tag "black" or "white"

Resources

Rationale

  1. Makes filters more powerful/intuitive
  2. Optimizes bandwidth
  3. Potentially optimizes relays
  4. Potentially optimizes client development
vitorpamplona commented 3 weeks ago

Making AND available only for tag queries makes sense in my mind.