42 lines
1.0 KiB
Markdown
42 lines
1.0 KiB
Markdown
# hyper-p2p-inverted-index
|
|
|
|
Distributed inverted index with term-level gossip sync over Hyperswarm.
|
|
|
|
**Category:** indexes-search
|
|
|
|
**Composes with:** hyper-p2p-topic-channel
|
|
|
|
**Protocol:** `inverted-index/v1`
|
|
|
|
## When to use
|
|
|
|
Peer-assisted document lookup where each node indexes local docs and merges remote term postings via gossip.
|
|
|
|
## When not to use
|
|
|
|
Large-scale search requiring ranked full-text scoring (use hyper-p2p-fulltext-lite) or exact global consistency without merge semantics.
|
|
|
|
## Quick start
|
|
|
|
```js
|
|
const { HyperP2PInvertedIndex } = require('hyper-p2p-inverted-index')
|
|
const topic = process.argv[2]
|
|
const mod = new HyperP2PInvertedIndex({ topic })
|
|
await mod.ready()
|
|
mod.index('doc-1', ['pear', 'p2p'])
|
|
console.log(mod.search('pear'))
|
|
await mod.close()
|
|
```
|
|
|
|
## Docs
|
|
|
|
- [docs/api.md](docs/api.md) — constructor, methods, events, errors
|
|
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition
|
|
- [../../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
|
|
|
|
## Test
|
|
|
|
```bash
|
|
npm install && npm test
|
|
```
|