useSpecSearch
Spec library search composable.
Import
typescript
const {
results,
isSearching,
searchSpecs,
searchByText,
} = useSpecSearch(brandName)Parameters
| Parameter | Type | Description |
|---|---|---|
brandName | Ref<string> | Brand filter (enforced) |
Return Values
| Property | Type | Description |
|---|---|---|
results | Ref<SpecSection[]> | Search results |
isSearching | Ref<boolean> | Search in progress |
Methods
| Method | Parameters | Returns | Description |
|---|---|---|---|
searchSpecs | query: string, areas?: string[] | Promise<void> | Hybrid semantic + keyword search |
searchByText | text: string | Promise<void> | Text-only search |
Search Behavior
All searches are automatically filtered by brandName (brand isolation enforced). The search uses the pip_ai_search_specs() RPC function which combines:
- Vector similarity (pgvector cosine distance)
- Keyword matching (title, content ILIKE)
Results are ranked by similarity score.
Source
app/composables/useSpecSearch.ts