Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
searchnos について
Search
Yoji Shidara
March 10, 2023
Technology
0
320
searchnos について
Yoji Shidara
March 10, 2023
Tweet
Share
More Decks by Yoji Shidara
See All by Yoji Shidara
Searchnos & Search on Nostr
dara
0
210
nostrbuzzsのしくみ
dara
0
460
How nostrbuzzs works
dara
0
73
About searchnos
dara
0
92
HOME, GOPATH and me
dara
3
1.6k
The First Step for Building Groonga Bindings with Golang
dara
6
1.3k
まほうのひととき - The Magic Hour
dara
7
870
JDK CHRONICLE
dara
2
8.7k
Timelapse Introduction
dara
1
620
Other Decks in Technology
See All in Technology
品質文化を支える小さいクロスファンクショナルなチーム / Cross-functional teams fostering quality culture
toma_sm
0
180
Running JavaScript within Ruby
hmsk
3
430
Aspire をカスタマイズしよう & Aspire 9.2
nenonaninu
0
360
GraphQLを活用したリアーキテクチャに対応するSLI/Oの再設計
coconala_engineer
0
190
Part2 GitHub Copilotってなんだろう
tomokusaba
0
170
持続可能なドキュメント運用のリアル: 1年間の成果とこれから
akitok_
1
270
日経電子版 for Android の技術的課題と取り組み(令和最新版)/android-20250423
nikkei_engineer_recruiting
1
620
Goの組織でバックエンドTypeScriptを採用してどうだったか / How was adopting backend TypeScript in a Golang company
kaminashi
12
9.1k
C++26アップデート 2025-03
faithandbrave
0
1.2k
MCPが変えるAIとの協働
knishioka
1
130
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
2
450
Gateway H2 モジュールで スマートホーム入門
minoruinachi
0
120
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
30
2.3k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
331
21k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
Building Flexible Design Systems
yeseniaperezcruz
329
39k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Intergalactic Javascript Robots from Outer Space
tanoku
271
27k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
How to train your dragon (web standard)
notwaldorf
91
6k
GraphQLの誤解/rethinking-graphql
sonatard
71
10k
Practical Orchestrator
shlominoach
187
11k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
14
1.4k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Transcript
searchnos について npub1q7qyk7rvdga5qzmmyrvmlj29qd0n45snmfuhkrzsj4rk0sm4c4psvqwt9c 2023-03-10 Nostr 勉強会 #1
@darashi nostrbuzzs の作者です。
searchnos とは https://github.com/darashi/searchnos Nostrbuzzs に検索機能がほしい、けど... NIP-50 (Search Capability; 検索) 対応のリレーが少ないので、自分で作ってみまし
た。 リレー風のサーバですが、フル機能のリレーではありません。
None
考えたこと リレーを自前で作るのは大変そう 現状でも既に大変そう 今後の NIP に対応し続けるのも大変そう リレーを自前で運用するのも大変そう ユーザのリレーリストに追加してもらい、こちらにイベントを投げてもらわ ないといけない。 そのレベルのものを運用するのは大変そう。
→ イベントは既存のリレーから取得するのがよさそう。小判鮫的な。
しくみ searchnos indexer searcher relay-1 relay-2 Elasticsearch web-browser
indexer 指定したリレーに接続し、kind1 とkind5 を購読する。イベントに応じて Elasticsearch の状態を更新する。 searcher REQ が来たら、 Elasticsearch
にクエリを投げて、結果を返し、最後にEOSE を送る。 (内部的な)クエリ購読者リストに追加する。 一定時間ごとにポーリング 購読者があるクエリを順番に Elasticsearch に投げて、新着の結果を購読者に 流す。
client searcher Elasticsearch indexer relay loop loop REQ w/"search" 1
query 2 response 3 EVENT (if matched) 4 EVENT (if matched) 5 EOSE 6 kind:1 7 index request 8 wait 9 query 10 response 11 EVENT (if matched & unread) 12 CLOSE 13 client searcher Elasticsearch indexer relay
おもしろポイント 同じクエリを購読しているクライアントのクエリは、一つにまとめて Elasticsearch に投げる。 buzzphrases に関していうと、何人もが同じクエリを購読することがよくあ る。 Simple query string
query ※ を使っているので、複雑な条件を持つ検索ができる ※ https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-simple- query-string-query.html
まとめ 既存のリレーから note を収集し、 NIP-50 に対応した検索機能を提供するリレー っぽいサーバーを作った。
今後の課題 通常のフィルタ条件 (NIP-01) に対応する。 現状 limit にしか対応できていない kind:0 (NIP-01) にも対応する...?
購読者の多いクエリは頻繁にポーリングするなど、もう少し賢いクエリスケジュ ーリング。 言語推定と言語によるフィルタリングに対応する...? spam フィルタに対応する...? どうやって...? NIP-56 があるので、信頼できるユーザの pubkey を定義して、その kind:1984 から spam フィルタを学習する、とかはありかもしれない。 運用が大変そう...