Search API
Dojo provides fast full-text search across all files in a repository. Search indexes are built automatically and maintained incrementally on every push.
Search repository files
Section titled “Search repository files”GET /api/repos/{owner}/{name}/searchQuery parameters:
| Parameter | Required | Default | Description |
|---|---|---|---|
q | ✅ | — | Search query |
ref | — | main | Branch/bookmark to search |
limit | — | 50 | Max results |
path | — | — | Filter results to paths containing this string |
Example:
curl "https://dojo.ninja/api/repos/mies/dojo/search?q=handleAuth&ref=main" \ -H "Authorization: Bearer $TOKEN"Response:
{ "query": "handleAuth", "results": [ { "path": "src/auth.ts", "snippet": "...export function >>>>handleAuth<<<<(req: Request) {...", "rank": -3.5 }, { "path": "src/middleware.ts", "snippet": "...const result = await >>>>handleAuth<<<<(c.req)...", "rank": -1.2 } ]}Results are ranked by relevance. Snippets use >>>> and <<<< markers to highlight matching terms.
Search workspace files
Section titled “Search workspace files”Search includes both committed files and the workspace overlay (uncommitted changes):
GET /api/repos/{owner}/{name}/workspaces/{wsId}/searchQuery parameters:
| Parameter | Required | Default | Description |
|---|---|---|---|
q | ✅ | — | Search query |
limit | — | 50 | Max results |
path | — | — | Path filter |
Response includes a source field:
{ "query": "handleAuth", "results": [ { "path": "src/auth.ts", "snippet": "...function >>>>handleAuth<<<<(req: Request)...", "rank": -3.5, "source": "base" }, { "path": "src/new-middleware.ts", "snippet": "...await >>>>handleAuth<<<<(c.req)...", "source": "overlay" } ]}"base"— match is from the committed files"overlay"— match is from an uncommitted workspace file
Query syntax
Section titled “Query syntax”| Query | Description |
|---|---|
error handling | Match documents containing both words |
"error handling" | Match exact phrase |
error OR warning | Match either word |
error NOT test | Match “error” but not “test” |
auth* | Prefix matching |
NEAR(error handler, 5) | Words within 5 tokens of each other |
What gets indexed
Section titled “What gets indexed”- All text files under 512KB
- UTF-8 encoded content
Excluded from indexing:
- Binary files (images, fonts, archives, compiled files)
- Generated/vendored paths (
node_modules/,vendor/,dist/) - Minified files (
*.min.*) - Lock files (
*.lock)
When indexes update
Section titled “When indexes update”- On push — only changed files are re-indexed (incremental)
- On workspace commit — index updated for the new commit
- On first search — built automatically if no index exists yet