A Google-style search engine demo powered by semlix — a single runnable app (FastAPI backend + a vanilla HTML/JS frontend) that searches the semlix documentation and shows off the whole stack:
- Hybrid search — lexical (BM25F) + semantic (sentence-transformers), fused, with a Lexical / Hybrid / Semantic toggle in the UI.
- Highlighted snippets under each result (like Google).
- "Did you mean…?" spelling correction.
- Fast — query latency shown in milliseconds.
It's also a bit of dogfooding: the corpus is the semlix docs, searched with semlix.
Hybrid results: highlighted snippets with per-result lexical + semantic scores and query latency.
A prebuilt index of the semlix docs ships in data/, so you can run the app
immediately — no indexing step needed:
pip install -r requirements.txt
python -m semlix_search.app # http://127.0.0.1:8000Lexical search (snippets + "did you mean") works out of the box. For
hybrid/semantic search, also pip install sentence-transformers (the query
embedder + model are only needed at query time; the document vectors are already
in data/vectors.npz). To rebuild the index from scratch, see Quick start below.
# 1. install (semlix comes from PyPI)
python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
# optional — enables semantic / hybrid search (downloads a small model on first run):
pip install sentence-transformers
# 2. build the index from the semlix docs (sibling ../semlix/docs/source by default)
python -m semlix_search.cli index # hybrid if sentence-transformers is installed
# or: python -m semlix_search.cli index --no-semantic # lexical only, no model download
# or: python -m semlix_search.cli index --docs /path/to/any/docs
# 3. run
python -m semlix_search.app # http://127.0.0.1:8000Open http://127.0.0.1:8000 and search.
- Indexer (
semlix_search/indexer.py) splits a docs tree (.rst/.md) into sections and builds a semlix coreFileIndex(enables highlighting + spelling). Ifsentence-transformersis present it also builds aNumpyVectorStoreviaHybridIndexWriter, so the same content is searchable lexically and semantically. - Backend (
semlix_search/app.py) — FastAPI:GET /api/search?q=…&mode=lexical|hybrid|semantic&limit=10GET /api/stats- With a vector store present it uses
semlix.semantic.HybridSearcher(modemaps to the fusionalpha); otherwise it serves lexical search with highlighted snippets and spelling correction. It always degrades gracefully.
- Frontend — one static
index.html(no build step): a Google-like page that calls the API and renders results, snippets, scores, latency and suggestions.
This demo uses the semlix core engine as its lexical half because that's what
provides highlighted snippets and spelling correction. For a much larger corpus
where you want raw throughput over those features, semlix also ships the bm25s
engine (semlix.bm25.BM25Index) — see the engine guide in the semlix docs.
| var | default |
|---|---|
SEMLIX_SEARCH_DOCS |
../semlix/docs/source |
SEMLIX_SEARCH_INDEX |
./data/index |
SEMLIX_SEARCH_VECTORS |
./data/vectors.npz |
SEMLIX_SEARCH_MODEL |
all-MiniLM-L6-v2 |

