Search
Full-text search over your markdown.
SharpDocs indexes every page at startup and exposes search per project.
- Single-project:
GET /search?q=... - Multi-project:
GET /docs/{projectId}/search?q=...
Search is per-project, not unified. Each project has its own search index, and results never cross project boundaries. In multi-project mode the navbar's search box posts to the active project's URL and hides entirely on the landing page (no project context).
How it scores
The index tokenizes each page's title, description, headings, and body. A query hits against each bucket with different weights:
| Match location | Score per token |
|---|---|
| Title | 10 |
| Heading (h2, h3) | 3 |
| Body | 1 |
Results are ranked by total score, descending. There's no stemming, no fuzzy matching, no stop-word list — it's deliberately simple.
The endpoint
When invoked by htmx from the in-page search box, the endpoint returns a results fragment that swaps into the dropdown without a full reload. Direct browser requests render a full page.
When to reach for something else
If you have hundreds of pages, multi-language content, or need typo-tolerance, the built-in index will feel thin. It's meant for small libraries — dozens of pages, not thousands. For bigger sites, put a third-party search (Algolia, Meilisearch) in front and ignore the built-in endpoint.