Skip to main content

Search SDK

RBS includes a powerful search engine built into every branch server. Search file contents, find files by name, and receive real-time file change notifications — all through a consistent API accessible from your editor or custom tooling.

Overview


Search for text or regex patterns across all files in your workspace. Results include line numbers, column positions, and configurable context lines.

API: POST /api/search

Full search with all options via JSON body:

Parameters

Response

Search via query parameters for simple lookups:

For large workspaces, use the streaming endpoint to receive results in real-time via Server-Sent Events (SSE):
Results arrive as they’re found:

Find files quickly by name using fuzzy matching — the same experience as Cmd+P / Ctrl+P in your editor.

API: GET /api/files/fuzzy

Response

An empty query returns recently modified files sorted by modification time — useful for “recent files” functionality.

How fuzzy matching works

The fuzzy matcher scores results based on:
  1. Character matching — all query characters must appear in order in the filename.
  2. Consecutive bonus — higher score for consecutive character matches.
  3. Word boundary bonus — higher score for matches at word boundaries (/, _, -, ., camelCase).
  4. Prefix bonus — higher score for matches at the start of the filename.
  5. Exact match bonus — highest score for exact matches.
  6. Length penalty — shorter filenames score higher.

Refresh the file index

The file index refreshes automatically every 30 seconds. To force a refresh:

File watcher

Receive real-time notifications when files change in the workspace via WebSocket.

Connect

On connection, you’ll receive a confirmation message:

Event types

Event format

For rename events, an additional old_path field is included:

Debouncing

File events are debounced (100ms) to prevent rapid-fire notifications when editors auto-save, build tools generate multiple files, or external tools batch-modify files.

REST endpoints


Default ignored patterns

All search and watcher features automatically skip:
  • .git, .hg, .svn directories
  • node_modules, vendor, __pycache__
  • .venv, venv, .env
  • dist, build, target
  • .idea, .vscode, .rbs
  • Binary files (images, executables, archives)
  • Files matching .gitignore patterns

Glob pattern examples


Editor SDK integration

If you’re building a custom editor integration, use the Search SDK client:

Performance tips

  1. Use glob filters — always specify include_glob when you know the file type.
  2. Limit results — set a reasonable max_results for UI responsiveness.
  3. Use streaming for large searches — the SSE endpoint returns results as they’re found.
  4. Debounce user input — wait 100–200ms before sending search requests when building a search UI.
  5. Leverage the cache — fuzzy file search results are cached and respond in milliseconds.
  6. Connect the watcher once — reuse a single WebSocket connection for file change events.