Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions 91.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# NIP-91: AND Operator in Filters

Enable `AND` within a single tag filter by using an `&` modifier in filters for indexable tags.

```
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"
```

## Rules

- `AND` **MUST** take precedence over `OR`
- Tag values used in `AND` **SHOULD NOT** be used in standard `OR` tags [`#`]
- Any tag value used in `AND` **SHOULD** be ignored in `OR`
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
- [NIP-84: Highlights](84.md)
- [NIP-89: Recommended Application Handlers](89.md)
- [NIP-90: Data Vending Machines](90.md)
- [NIP-91: AND filters](91.md)
- [NIP-92: Media Attachments](92.md)
- [NIP-94: File Metadata](94.md)
- [NIP-96: HTTP File Storage Integration](96.md)
Expand Down Expand Up @@ -201,6 +202,17 @@ They exist to document what may be implemented by [Nostr](https://github.com/nos
[lnpub]: https://github.com/shocknet/Lightning.Pub/blob/master/proto/autogenerated/client.md
[joinstr]: https://gitlab.com/1440000bytes/joinstr/-/blob/main/NIP.md

## Filters

| kind | description | NIP |
| --------------- | -------------------------- | ------------------------ |
| `authors` | by pubkey | [01](01.md) |
| `ids` | by ids | [01](01.md) |
| `kinds` | by kinds | [01](01.md) |
| `#{}` | by indexable tag (OR) | [01](01.md) |
| `&{}` | by indexable tag (AND) | [91](91.md) |
| `search` | by search times | [50](50.md) |

## Message types

### Client to Relay
Expand Down