Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching for a name should search the username #3

Open
alexgleason opened this issue Jan 2, 2024 · 1 comment
Open

Searching for a name should search the username #3

alexgleason opened this issue Jan 2, 2024 · 1 comment

Comments

@alexgleason
Copy link

alexgleason commented Jan 2, 2024

Here's my REQ:

> ["REQ", "_", { "kinds": [0], "search": "alex", "limit": 3 }]
< ["EVENT","_",{"content":"{\"about\":\"Arctic Circle by Alex Hallatt\\n\\nhttps://www.arcamax.com/thefunnies/arcticcircle\",\"name\":\"Arctic Circle (RSS Feed)\",\"nip05\":\"https://www.comicsrss.com/rss/[email protected]\",\"picture\":\"https://www.arcamax.com/jsnews/images/comics/arcticcircle.png\"}","created_at":1704218472,"id":"9ff1cd4463f6bb7ff1f985d6d06b93fae1d6f108fb56e88327d8793819a966fc","kind":0,"pubkey":"559d935f1e282c596e8413afbb77e59f2144f6746c847c6c277bf1676405010b","sig":"deb568f0bf209239ed36425ae14293ca1f04509dd919f5a79cf9801ee5f7fa4f2466e9c5b02cdde95ef03b429ba65cf5f79b979d5f66dca35f7de1fad9752376","tags":[]}]
< ["EVENT","_",{"content":"{\"about\":\"Amazing Spider-man by Stan Lee And Alex Saviuk\\n\\nhttps://comicskingdom.com/amazing-spider-man\",\"name\":\"Amazing Spider-man (RSS Feed)\",\"nip05\":\"https://www.comicsrss.com/rss/[email protected]\",\"picture\":\"https://api.kingdigital.com/img/features/522/logos/website.png\"}","created_at":1704218471,"id":"dfef70bb34ef66e6aa70b04311d1104f89e9535d2dc15d211cde5e2b234c8f3f","kind":0,"pubkey":"2bb1c62ce1670055f9b6195035290189d7da40a2ceb0b951fcdecbe2c5b76f68","sig":"c3e8dd6e25ad250a1b5423411c194b8f24e2fc2bf99c371da2e82f8ad868c7a905f5d237ba54b3a5b18cd733340dd5a938eda4467e0d736e108c9f7602e6dee4","tags":[]}]
< ["EVENT","_",{"content":"{\"name\":\"alexGT3\",\"picture\":\"https://void.cat/d/NVhJTGHemgou7y3JAN2c2V.webp\"}","created_at":1704174981,"id":"105936aeb49e032df3cfd430713f74d1e8c7fbb04d7758ee849048e05bc4decf","kind":0,"pubkey":"00b28cb80e3b653290554f980b03620514eb35b2dbae5437ebe226a2b8c54894","sig":"8accf9fa078c819594ce06abfb06c935af093003831ff720d1f1c390422c302909466946451adfaa52b8bd08174d9e11f5786b7a7816a1adaace5175c98fb97b","tags":[]}]
< ["EOSE","_"]

What it does: Returns people who have the word "alex" in their bio.

What it should do: Return people who have "alex" in their display name and/or NIP-05.

Special treatment for kinds: [0] filters should be applied. And when kind 0 events are indexed, their content should get parsed.

@darashi
Copy link
Owner

darashi commented Jan 2, 2024

Thank you for the report.

If I am not mistaken in my implementation, Searchnos parses content in kind 0 events as a JSON and indexes its values. Therefore, nip05 field should also be searched.

https://github.com/darashi/searchnos/blob/main/src/index/text.rs#L6-L10

The problem seems to be that my relay, search.nos.today is currently set to not keep events older than the last 30 days. This may cause the metadata you are expecting not to be returned.

In fact, after updating my kind 0, the search appears to be working as intended:

❯ echo '["REQ", "_", {"search": "[email protected]", "kind": 0}]' | websocat -n wss://search.nos.today
["EVENT","_",{"content":"{\"display_name\":\"darashi\",\"nip05\":\"[email protected]\",\"lud16\":\"[email protected]\",\"about\":\"I built:\\nmapnos https://mapnos.vercel.app\\nnos.today https://nos.today\\nsearchnos https://github.com/darashi/searchnos\\nnostrbuzzs https://nostrbuzzs.deno.dev/\",\"name\":\"darashi\",\"website\":\"https://darashi.net\",\"picture\":\"https://avatars.githubusercontent.com/u/2363?v=4\"}","created_at":1704232542,"id":"d47787ca00616471ea083a43cb7690a7252ae5d69d212c6450509c4dffec7161","kind":0,"pubkey":"07804b786c6a3b400b7b20d9bfc945035f3ad213da797b0c50954767c375c543","sig":"e09169f0c677566e27dc83c7f9bcd73a2eef266946a3d6992b7f2ef881dd61bfa7afa3a75ed35aa3b538428275783ac33d7f4e390e09f4f731e0028cfc08b2b8","tags":[]}]
["EOSE","_"]

Could you please check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants