upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/12.md
diff options
context:
space:
mode:
authorfiatjaf <fiatjaf@gmail.com>2022-07-10 15:32:55 -0300
committerfiatjaf <fiatjaf@gmail.com>2022-07-10 15:33:07 -0300
commit3771186c0351656a675576051b75d253f26c0f0b (patch)
treea972d9f6fda3cd25a837de0b35229ef1c32494c5 /12.md
parent5980907797231b3efb7fc1c43c4206fd11fbd947 (diff)
change NIP-12 so only single-letter tags are indexed.
Diffstat (limited to '12.md')
-rw-r--r--12.md24
1 files changed, 14 insertions, 10 deletions
diff --git a/12.md b/12.md
index 1d5ba1f..74c9d81 100644
--- a/12.md
+++ b/12.md
@@ -4,35 +4,39 @@ NIP-12
4Generic Tag Queries 4Generic Tag Queries
5------------------- 5-------------------
6 6
7`draft` `optional` `author:scsibug` 7`draft` `optional` `author:scsibug` `author:fiatjaf`
8 8
9Relays may support subscriptions over arbitrary tags. `NIP-01` requires relays to respond to queries for `e` and `p` tags. This NIP allows any tag present in an event to be queried. 9Relays may support subscriptions over arbitrary tags. `NIP-01` requires relays to respond to queries for `e` and `p` tags. This NIP allows any single-letter tag present in an event to be queried.
10
11The `<filters>` object described in `NIP-01` is expanded to contain arbitrary keys with a `#` prefix. Any key in a filter beginning with `#` is a tag query, and MUST have a value of an array of strings. The filter condition matches if the event has a tag with the same name, and there is at least one tag value in common with the filter and event. The tag name is the first element of a tag array with the initial `#` removed, and the tag value is the second element. Subsequent elements are ignored for the purposes of tag queries.
12 10
11The `<filters>` object described in `NIP-01` is expanded to contain arbitrary keys with a `#` prefix. Any single-letter key in a filter beginning with `#` is a tag query, and MUST have a value of an array of strings. The filter condition matches if the event has a tag with the same name, and there is at least one tag value in common with the filter and event. The tag name is the letter without the `#`, and the tag value is the second element. Subsequent elements are ignored for the purposes of tag queries.
13 12
14Example Subscription Filter 13Example Subscription Filter
15--------------------------- 14---------------------------
16 15
17The following provides an example of a filter that matches events of kind `1` with a `foo` tag set to either `bar` or `baz`. 16The following provides an example of a filter that matches events of kind `1` with an `r` tag set to either `foo` or `bar`.
18 17
19``` 18```
20{ 19{
21 "kinds": [1], 20 "kinds": [1],
22 "#foo": ["bar", "baz"] 21 "#r": ["foo", "bar"]
23} 22}
24``` 23```
25 24
26Client Behavior 25Client Behavior
27--------------- 26---------------
28 27
29Clients SHOULD use the `supported_nips` field to learn if a relay supports generic tag queries. Clients MAY send generic tag queries to any relay, if they are prepared to filter out extraneous responses from relays that do not support this NIP. 28Clients SHOULD use the `supported_nips` field to learn if a relay supports generic tag queries. Clients MAY send generic tag queries to any relay, if they are prepared to filter out extraneous responses from relays that do not support this NIP.
29
30Rationale
31---------
32
33The decision to reserve only single-letter tags to be usable in queries allow applications to make use of tags for all sorts of metadata, as it is their main purpose, without worrying that they might be bloating relay indexes. That also makes relays more lightweight, of course. And if some application or user is abusing single-letter tags with the intention of bloating relays that becomes easier to detect as single-letter tags will hardly be confused with some actually meaningful metadata some application really wanted to attach to the event with no spammy intentions.
30 34
31Suggested Use Cases 35Suggested Use Cases
32------------------- 36-------------------
33 37
34Motivating examples for generic tag queries are provided below. This NIP does not promote or standardize the use of any specific tag for any purpose. 38Motivating examples for generic tag queries are provided below. This NIP does not promote or standardize the use of any specific tag for any purpose.
35 39
36* Decentralized Commenting System: clients can comment on arbitrary web pages, and easily search for other comments, by using a `url` tag and value. 40* Decentralized Commenting System: clients can comment on arbitrary web pages, and easily search for other comments, by using a `r` ("reference", in this case an URL) tag and value.
37* Location-specific Posts: clients can use a `geohash` tag to associate a post with a physical location. Clients can search for a set of geohashes of varying precisions near them to find local content. 41* Location-specific Posts: clients can use a `g` ("geohash") tag to associate a post with a physical location. Clients can search for a set of geohashes of varying precisions near them to find local content.
38* Hashtags: clients can use simple `hashtag` tags to associate an event with an easily searchable topic name. Since Nostr events themselves are not searchable through the protocol, this provides a mechanism for user-driven search. 42* Hashtags: clients can use simple `t` ("hashtag") tags to associate an event with an easily searchable topic name. Since Nostr events themselves are not searchable through the protocol, this provides a mechanism for user-driven search.