Logo Distributed Search

Distributed Search

Tổ chức
proyecto26
distributed-search

Nên dùng kỹ năng này khi người dùng thiết kế “hệ thống tìm kiếm”, cần “tìm kiếm toàn văn”, hỏi về “chỉ mục đảo”, “Elasticsearch / OpenSearch”, “xếp hạng mức độ liên quan” (TF-IDF/BM25), “tự động hoàn thành / gợi ý khi nhập” trong tìm kiếm, “pipeline lập chỉ mục” hoặc “tìm kiếm theo bộ lọc”. Kỹ năng này trình bày kiến trúc thu thập/lập chỉ mục/tìm kiếm, phân mảnh và sao chép chỉ mục, xếp hạng và lập chỉ mục gần thời gian thực. Hãy dùng kỹ năng này khi người dùng cần truy vấn văn bản theo mức độ liên quan thay vì lấy hàng theo khóa — ngay cả khi họ không nói đến “công cụ tìm kiếm”.

Add to TypingMind

Tổng quan

Nhà phát hànhproyecto26
Kho mãsystem-design-skills
Tên kỹ năngdistributed-search
Sao
117
Bản fork
14
Tệp đi kèm
5
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 5 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được proyecto26 công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Distributed Search trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/proyecto26/system-design-skills/tree/main/skills/distributed-search
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/proyecto26/system-design-skills.git /tmp/system-design-skills
mkdir -p .claude/skills
cp -r /tmp/system-design-skills/skills/distributed-search .claude/skills/distributed-search
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Distributed Search trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Distributed Search ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Distributed Search với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Distributed search

Find the documents that best match a free-text query, ranked by relevance, fast, across more data than one machine holds. Getting it wrong means either slow LIKE '%term%' scans that melt the primary database, or a search box that returns the wrong results and erodes user trust — both are silent until traffic or corpus size exposes them.

When to reach for this

Users type words and expect ranked, relevant matches — not exact-key lookups. The corpus is text-heavy (documents, products, logs, messages), queries are ad-hoc (any term, any combination), and results need ranking, highlighting, facets, or typeahead. Reach for it when a WHERE col LIKE or full-table scan is already the read bottleneck, or when you need fuzzy/partial matching a B-tree index cannot serve.

When NOT to

The access pattern is fetch-by-known-key or a fixed filter — a primary database index serves that far more cheaply and consistently; keep it in data-storage. The corpus is tiny (thousands of rows): an in-process filter or the database's built-in full-text index is enough — a separate search cluster is pure operational overhead (YAGNI). Search is a derived, eventually-consistent copy of your data; never make it the system of record.

Clarify first

  • Corpus size and growth — document count, average doc size, total index bytes? (→ back-of-the-envelope) This decides shard count.
  • Query QPS and shape — read-heavy? term queries, phrase, fuzzy, facets, autocomplete? Latency target (p99)?
  • Indexing freshness — must a new/edited doc be searchable in seconds (near-real-time) or is minutes/hours of lag fine?
  • Relevance bar — is exact term-match enough, or do users expect "best" results (ranking, synonyms, typo tolerance)?
  • Write rate — how many docs/sec change? This sizes the indexing pipeline.

The options

The pipeline (almost always present): a source emits document changes → an indexing pipeline transforms/analyzes them → the inverted index stores term→document postings → the query path matches and ranks. For a crawl-based system (web search), prepend crawl → parse → dedupe; that crawler is its own subsystem feeding the same pipeline.

Index build mode

  • Batch / bulk reindex: rebuild the whole index periodically. Use when the corpus changes slowly or freshness in hours is acceptable.
  • Near-real-time (incremental): apply changes continuously so docs are searchable in seconds. Use when users expect to find what they just wrote.

Ranking model

  • Boolean / filter only: match, no scoring. Use for exact filtering (tags, facets) where order doesn't matter.
  • TF-IDF / BM25 (lexical): score by term frequency and rarity. The default full-text relevance model; cheap and explainable.
  • Hybrid (lexical + signals): blend BM25 with popularity, recency, or business boosts. Use when "best" means more than word overlap.

Autocomplete

  • Prefix trie / FST in memory: sub-millisecond typeahead from a prefix. Use for suggestion-as-you-type.
  • Edge-n-gram index: prefix matching inside the main index. Use when suggestions must also respect filters/relevance, at higher cost.

Distribution: split the index into shards (each a self-contained inverted index over a doc subset) for capacity, and replicas per shard for read throughput and fault tolerance. Sharding theory lives in data-storage.

Trade-offs

OptionWhat it solvesWhat it worsensChange it when
Batch reindexSimple, atomic swap, no live-write complexityStale until next build; full rebuild is costlyUsers need fresh results → near-real-time
Near-real-timeSeconds-fresh; no full rebuildSegment churn, merge load, refresh cost on writesWrite rate or merge cost overwhelms nodes → batch/larger refresh interval
Boolean/filterCheapest; deterministicNo notion of "best" resultUsers judge result quality → add BM25
BM25Good relevance, explainable, cheapIgnores popularity/recency/intentWord-overlap isn't enough → hybrid signals
Hybrid signalsMatches business/user intentComplex, harder to debug, needs tuning dataTuning cost exceeds value → fall back to BM25
Prefix trie/FSTFastest typeaheadSeparate structure to build/refresh; ignores filtersSuggestions need filters/relevance → edge-n-gram
More shardsParallelism, fits big corpusPer-query fan-out + merge overhead; tiny shards waste resourcesFan-out latency dominates → fewer, larger shards
More replicasRead QPS + HAMore RAM/disk; replication lag on writesWrite amplification hurts → fewer replicas

Behavior under stress

Search amplifies trouble through fan-out and derived-data lag.

  • Query fan-out tail latency: every query hits all shards; the slowest shard sets the response time. One hot or GC-paused shard drags every query. Mitigate: size shards evenly, add replicas, cap result depth, use timeouts + partial results.
  • Indexing vs query contention: a write/merge surge (bulk import, reindex) steals CPU and I/O from queries, spiking latency. Mitigate: throttle bulk indexing, schedule big merges off-peak, isolate index vs query node roles.
  • Hot shard / skew: an uneven shard key concentrates docs or popular terms on one node. Mitigate: hash-route documents; reroute or split the hot shard.
  • Deep pagination: from=100000 forces every shard to sort huge windows. Mitigate: cursor/search_after, cap page depth.
  • Pipeline backlog: if the source produces changes faster than the indexer consumes, freshness lag grows unbounded. Mitigate: backpressure and a durable buffer (→ messaging-streaming); monitor lag, not just throughput.
  • Cold cache after restart: filesystem/page cache is empty, so latency spikes until it warms. Mitigate: warm critical queries; ramp traffic.

Monitor: per-shard p99 query latency, indexing lag (source→searchable), segment/merge count, heap/GC, shard balance, and rejected/queued requests.

How to apply

  1. Clarify the inputs — pin corpus size, query QPS and shape, freshness target, and the relevance bar (see Clarify first). If a DB index or built-in full-text serves the access pattern, stop — you don't need a search cluster.
  2. Pick from the trade-off table — choose a build mode (freshness), a ranking model (relevance bar), and whether autocomplete needs its own structure.
  3. Set the key knobs — shard count (from index bytes ÷ target shard size), replica count (from read QPS + HA), the analyzer/tokenizer (language, stemming, synonyms), and the refresh interval (freshness vs write cost).
  4. Stress-test the choice — walk Behavior under stress (fan-out tail, indexing contention, hot shard, deep pagination, pipeline backlog) and confirm a mitigation for each one the traffic profile can trigger.
  5. Size it with numbers — confirm shards fit the corpus and per-shard size stays in a healthy range, replicas cover peak QPS, and indexing throughput keeps lag inside the freshness budget (→ Numbers that matter).
  6. Pick a provider — default to the generic recipe; open a provider file only if the user named a cloud (see Choosing a provider).
  7. Show the trade-off in the answer — give a Decision | Solves | Worsens | Change it when… table with one row per choice you made here (e.g. the option, its store, its failure policy); the last column is a concrete trigger (a number or observable signal). Then name what breaks first.

Dos and don'ts

Do

  • Treat the index as a derived, rebuildable copy — keep the system of record in data-storage and be able to fully reindex from it.
  • Size shards before launch (corpus ÷ target shard size); aim for even, not tiny, shards to bound fan-out cost.
  • Feed the indexing pipeline through a durable buffer so a write surge can't outrun the indexer or lose changes.
  • Start ranking with BM25; add popularity/recency signals only when word-overlap demonstrably misses intent.
  • Monitor indexing lag separately from query latency — freshness fails silently.

Don't

  • Don't use a search engine as your primary store or for transactional writes.
  • Don't reach for a separate cluster when a DB full-text index or in-process filter covers a small corpus (YAGNI).
  • Don't allow deep from/offset pagination; use cursors instead.
  • Don't over-shard — many tiny shards add fan-out and merge overhead without benefit.
  • Don't run heavy bulk reindex unthrottled against a cluster serving live queries.

Numbers that matter

The quantities that drive the design: total index bytes (corpus × per-doc overhead, then ÷ target shard size to get shard count), read QPS × fan-out (each query touches every shard) for replica sizing, and indexing throughput vs change rate to keep freshness lag inside budget. A single shard performs well within a bounded size range; past it, split. Use back-of-the-envelope for the latency, QPS, and storage figures — don't restate them here.

Interface sketch

The contracts are the document, the query, and the postings. A document is a typed record with analyzed fields, e.g. { "id": "p123", "title": "...", "body": "...", "tags": ["a","b"], "price": 9.99 }. A query names fields, match type, filters, sort, and pagination cursor, e.g. q="wireless earbuds", fields=[title^2, body], filter={tag:audio}, sort=_score, search_after=<cursor>. The inverted index maps each term → posting list of (doc_id, term_freq, positions); ranking reads these to compute BM25. Decide the analyzer (tokenizer, lowercasing, stemming, synonyms) up front — it is part of the contract and changing it requires a reindex.

Choosing a provider

Default to the generic recipe above (Elasticsearch/OpenSearch, Lucene, Solr, self-hosted). If the user names a cloud, read references/providers/<provider>.md for the managed-service mapping, quotas/limits, and provider-specific trade-offs. If no file exists for that provider, the generic recipe is the answer.

Diagram

To visualize the source → indexing pipeline → inverted index (sharded + replicated) → query/rank path, or the crawl→parse→dedupe front end, use the in-plugin architecture-diagram skill — show the indexing path and the query fan-out as distinct flows, with replicas behind each shard.

Related building blocks

  • data-storage — alternative to a DB LIKE/full-table scan for text search; search owns the inverted index, while sharding/partitioning and replication theory live there — name and link, don't re-teach.
  • messaging-streaming — depends on this for the index-update pipeline: a durable buffer carries document changes to the indexer and absorbs write surges (delivery, ordering, backpressure are owned there).
  • caching — pairs with this to cache hot/repeated queries and reduce fan-out load (stampede, hot-key, eviction handling owned there).
  • back-of-the-envelope — feeds into this skill: corpus bytes, QPS, and freshness numbers size the shards, replicas, and pipeline.
  • system-design — owned-concept lives in the orchestrator: the reasoning loop, the trade-off method, and the ten failure modes.

References

  • references/deep-dive.md — inverted-index internals (postings, segments, merges), the crawl/index/search pipeline, BM25 scoring, near-real-time refresh, autocomplete (trie/FST/n-gram), shard routing and replica reads. Read when designing the search layer in detail.
  • references/providers/{generic,aws,azure,gcp}.md — service mappings, limits, and pitfalls per environment.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Distributed Search làm được gì?

Nên dùng kỹ năng này khi người dùng thiết kế “hệ thống tìm kiếm”, cần “tìm kiếm toàn văn”, hỏi về “chỉ mục đảo”, “Elasticsearch / OpenSearch”, “xếp hạng mức độ liên quan” (TF-IDF/BM25), “tự động hoàn thành / gợi ý khi nhập” trong tìm kiếm, “pipeline lập chỉ mục” hoặc “tìm kiếm theo bộ lọc”. Kỹ năng này trình bày kiến trúc thu thập/lập chỉ mục/tìm kiếm, phân mảnh và sao chép chỉ mục, xếp hạng và lập chỉ mục gần thời gian thực. Hãy dùng kỹ năng này khi người dùng cần truy vấn văn bản theo mức độ liên quan thay vì lấy hàng theo khóa — ngay cả khi họ không nói đến “công cụ tìm kiếm”.

Vì sao nên dùng Distributed Search trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Distributed Search là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Distributed Search trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/proyecto26/system-design-skills/tree/main/skills/distributed-search. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Distributed Search?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Distributed Search với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Distributed Search với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Distributed Search có miễn phí không?

Có. Kỹ năng này được proyecto26 phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả
Logo của firecrawl

Firecrawl Build

firecrawl
Tổ chứcPhổ biến

Tích hợp Firecrawl vào mã ứng dụng bất cứ khi nào sản phẩm, tác nhân AI hoặc quy trình làm việc cần dữ liệu web bên trong ứng dụng — như tìm kiếm web, kết quả tìm kiếm trực tiếp, thu thập dữ liệu trang, trích xuất có cấu trúc hoặc tương tác…

9.8K
181.6K
6 tệp
Xem
Logo của Shubhamsaboo

Advisor Orchestrator Worker

Shubhamsaboo
Cộng đồngPhổ biến

Dùng khi một tác vụ quá lớn để xử lý trong một lượt của mô hình, cần nghiên cứu hoặc tạo nội dung song song cho nhiều phần việc (chẳng hạn nghiên cứu hàng tá đối thủ cùng lúc), hoặc người dùng muốn điều phối…

20.4K
138.7K
4 tệp
Xem
Logo của openai

Openai Docs

openai
Tổ chứcPhổ biến

Dùng cho các chủ đề về mô hình/giá của Codex, tác vụ theo lịch, kỹ năng, cài đặt, thiết lập, khắc phục sự cố, tùy chỉnh, tự động hóa và kiến thức về chính Codex — bao gồm các từ như “bạn”, “của bạn”, “ứng dụng này” hoặc “tác nhân lập trình này” khi…

19.9K
127.4K
15 tệp
Xem
Logo của JuliusBrussee

Caveman Explore

JuliusBrussee
Cộng đồngPhổ biến

Công cụ khám phá kho lưu trữ ở chế độ chỉ đọc, dùng để làm quen nhanh khi bắt đầu, định vị trên nhiều tệp hoặc khi tìm kiếm trực tiếp không thành công. Bỏ qua nếu đã biết chính xác tên tệp hoặc ký hiệu. Chỉ trả về trích dẫn dạng đường_dẫn:dòng…

6.2K
106.3K
2 tệp
Xem

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇