1.1 KiB
1.1 KiB
Architecture: hyper-p2p-fulltext-lite
Category: indexes-search
Protocol: fulltext-lite/v1 (local-only)
Purpose
Provide minimal inverted-index full-text search for Bare/Pear without network replication.
Data structures
_docs: Map<docId, { id, text, tokens, at }>
_index: Map<term, Set<docId>>
Wire messages
| type | notes |
|---|---|
| — | No gossip or Protomux channel |
Query pipeline
tokenize(query)→ terms[]- For each term, load posting set (or empty)
- Intersect sets across terms
- Score each hit doc by matching term count
- Sort descending by
score
Indexing pipeline
- Tokenize document body
- If
idexists, remove old postings per previous tokens - Insert new postings for each token
- Store document record
Lifecycle
new → addDocument/search → close (clear)
ready() is a no-op resolve.
Composition
Depends on ../../_shared/lib/errors.js only. No p2p-bare.js.
When to compose upstream
Pair with hyper-p2p-inverted-index when peers must share term postings, or with app-level Hyperbee persistence for durability.