Documentation Style
Goal
Docs should be copy/paste runnable and should teach the lifecycle: init → ingest → commit → (refresh) → search → maintain (inspect/compact)
Assume a junior/mid developer integrating Searchlite for the first time.
Required conventions (use everywhere)
1) Always introduce an index path variable
Prefer:
- •CLI docs:
INDEX=/tmp/searchlite_idx - •HTTP docs:
SEARCHLITE_INDEX_PATH=/tmp/searchlite_idx
2) Always mention the required ID field
- •Every document must include the schema’s
doc_id_field(default_id) - •If a doc is missing it, it will be rejected
3) Always include an explicit commit step after writes
Searchlite buffers writes. Your examples must show:
- •
commitafteradd/bulk/delete
4) Always call out refresh semantics for HTTP
- •If
--refresh-on-commitis disabled, readers may be stale untilPOST /refresh.
5) Always call out fast vs stored
- •
stored: truecontrols what can be returned - •
fast: truecontrols what can be filtered/aggregated efficiently
Safety warnings (must appear in HTTP docs)
The HTTP server:
- •provides no authentication
- •provides no authorization
- •provides no rate limiting
Docs must include a bold warning:
- •“Do not expose directly to untrusted networks; place behind a proxy/API gateway that enforces auth + rate limiting.”
Also include the “bind safely” recommendation:
- •default bind is localhost; show how to bind
0.0.0.0only when behind a firewall/proxy.
Examples must be complete
Every guide/example must include all three artifacts:
- •schema JSON
- •documents (NDJSON or JSON)
- •request JSON (search / filter / aggs / etc)
Do not show “…”-style pseudo snippets for the main flow. If you must omit details, provide:
- •a minimal working version
- •then an “extended” version
Code block conventions
- •Use fenced blocks with language tags:
- •
bash,json,yaml
- •
- •Prefer 1 command per line
- •When showing multi-step flows, number them
Docs structure templates
Quickstart / tutorial
- •Install / build
- •Init index
- •Add docs
- •Commit
- •Search (show return_stored + highlight)
- •Inspect / stats
- •Compact (explain why)
HTTP serving guide
- •Security warning (no auth)
- •Run server (CLI flag form + env var form)
- •
/initexample - •
/add(NDJSON streaming) +/commit(+ optional/refresh) - •
/searchexample - •Maintenance endpoints (
/inspect,/stats,/compact,/refresh) - •Troubleshooting section (body size, timeouts, commit/refresh)
Reference docs (query/filter/aggs)
- •Start with “Field requirements”
- •aggs require fast fields (terms = keyword fast; percentiles = numeric fast; etc.)
- •Include at least one runnable example per feature:
- •fuzzy
- •phrase/slop
- •collapse + inner_hits
- •rescore
- •profile/explain
- •vectors (feature-gated)
Consistency + contract sync
Whenever docs mention HTTP behavior:
- •ensure it matches
openapi.yaml - •errors should be shown as
{"error":{"type":"...","reason":"..."}}
Whenever docs mention request JSON shape:
- •ensure it matches
search-request.schema.json
“Docs review” checklist
- • Uses
INDEXorSEARCHLITE_INDEX_PATH - • Includes schema + docs + request JSON
- • Includes commit step
- • HTTP docs include security warning + refresh semantics
- • Notes fast vs stored requirements
- • Commands work as written (no placeholders)
- • Cross-links or references to related guides/endpoints