Simple Search
src/basic-search.ts
Search Options
src/search-options.ts
Options Reference
| Option | Type | Default | Description |
|---|---|---|---|
topK | number | 10 | Maximum results to return |
threshold | number | 0.3 | Minimum similarity score (0-1) |
filter | function | - | Filter function for metadata |
includeVector | boolean | false | Include raw vectors in results |
Search Results
Each result contains:src/types/search-result.ts
Understanding Scores
Scores range from 0 to 1:- 0.8-1.0: Very high similarity (nearly identical meaning)
- 0.6-0.8: High similarity (strongly related)
- 0.4-0.6: Moderate similarity (related concepts)
- 0.2-0.4: Low similarity (loosely related)
- 0.0-0.2: Very low similarity (probably unrelated)
src/interpret-scores.ts
Error Handling
src/error-handling.ts
Empty Results
Common reasons for empty results:- Threshold too high - Lower the
thresholdoption - No matching documents - Check that documents are indexed
- Filter too restrictive - Review your
filterfunction
src/debug-empty.ts
Related
Filtering
Filter search results
Thresholds
Tune similarity thresholds
Performance
Optimize search performance