Skip to main content

Module search

Module search 

Source
Expand description

Searching for people and notes (NIP-50): what is asked of the relays that search, and what is made of their answers.

A search is a filter with the words in its search field, which only some relays answer: the account’s search relays (see crate::nostr::relay_lists). Each sends what it found with the best match first, as NIP-50 has it, and that order is all that says how good a match is: the answers of several relays are taken a rank at a time, the best of each first.

What is typed may also name a person or a note outright, by its address (NIP-19). That is no search: it is opened, and no relay is told what was typed. A name at a domain (NIP-05) is asked of its domain, and the address of a relay shows what that relay has. And a secret key is none of these: it is sent nowhere.

Enums§

Found
What a search found, the best match first.
SearchFor
What is searched for.
Typed
What the words typed are: words to search for, or something else.

Constants§

NOTES_LIMIT 🔒
PEOPLE_LIMIT 🔒
How many people, and how many notes, one search asks each relay for.

Functions§

filter
The filter that asks a relay that searches for what words find of what.
followed_first
people, with those of them in followed first, and otherwise in the order they were in. A relay ranks by what a profile says, which anyone can say: the people an account follows are the ones it meant, when a name is theirs and others’ too.
latest_notes
The filter that asks a relay for the notes it got last: what it has, for whoever wants to see what a relay is like.
named 🔒
What words, which are no address of a person or a note, are: the address of a relay, when they start as one; a name at a domain; or words to search for.
ranked
The answers of several relays as one: answers is what each relay sent, the best match first, and the result takes the best of each, then the second of each, and so on, every event once, as it first came.
typed
What typed is: an address, with or without nostr: before it, a secret (a key, or the address of a remote signer), the address of a relay, a name at a domain, or words.