Search Observations
GET /search
Search observations using full-text search.
Query Parameters
Search query. Supports multiple words, automatically quoted for safety.
Filter by observation type (e.g., “bug”, “architecture”)
Filter by project name
Filter by scope:
project or personalMaximum results to return (1-20)
Response
Returns an array of search results with relevance ranking:Observation ID
Session ID
Observation type
Observation title
Full observation content
FTS5 relevance rank (lower is better)
Example
Search Behavior
Query Sanitization
All search queries are automatically sanitized to prevent FTS5 syntax errors:Ranking
Results are ranked by FTS5’s BM25 algorithm, which considers:- Term frequency - How often the search terms appear
- Document length - Shorter documents with matches rank higher
- Term rarity - Rare terms contribute more to relevance
rank values indicate better matches (FTS5 uses negative scores).
Searched Fields
FTS5 searches across multiple fields:title- Observation titlecontent- Full observation contenttool_name- Tool that created the observationtype- Observation typeproject- Project name
Soft-Deleted Observations
Search excludes observations withdeleted_at set (soft-deleted). Hard-deleted observations are permanently removed from the index.
Multi-Word Queries
Multi-word queries match observations containing all terms (AND logic):Empty Results
If no observations match, returns an empty array:Search Limits
The maximum limit is capped at 20 results to ensure performance. Default is 10.Error Handling
Missing Query Parameter
Invalid Parameters
Invalid filter values are ignored. For example, a non-existent project returns empty results rather than an error.Search Tips
- Be specific - More specific queries return better results
- Use filters - Combine text search with
type,project, andscopefilters - Check rank - Lower rank values indicate more relevant matches
- Try variations - If no results, try different terms or broader queries
Performance
FTS5 provides sub-millisecond search performance for typical databases:- 1,000 observations: ~1ms
- 10,000 observations: ~5ms
- 100,000 observations: ~20ms