Overview
Batch search lets you run multiple search strategies — semantic, fulltext, and aggregate — in a single request. Results are automatically deduplicated so you get the best matches from each strategy without duplicates.
Batch search is ideal when you want comprehensive results without making multiple API calls. Each strategy runs in parallel on the server for maximum speed.
Supported Strategies
Each search in the batch specifies a strategy:
- semantic — Vector similarity search based on meaning
- fulltext — Full-text search for exact keyword matching
- hybrid — Combined semantic + fulltext with score fusion
Up to 5 searches may be submitted per batch. Each item's limit caps at 50.
API Endpoint
POST /v1/search/batch
{
"searches": [
{ "query": "deployment configuration", "strategy": "semantic", "limit": 5 },
{ "query": "deploy config yaml", "strategy": "fulltext", "limit": 5 },
{ "query": "production setup", "strategy": "hybrid", "limit": 5 }
],
"deduplicate": true
}SDK Examples
import { Trix } from '@trixdb/client';
const trix = new Trix({ apiKey: process.env.TRIX_API_KEY });
const result = await trix.search.batchSearch([
{ query: 'deployment configuration', strategy: 'semantic', limit: 5 },
{ query: 'deploy config yaml', strategy: 'fulltext', limit: 5 },
{ query: 'production setup', strategy: 'hybrid', limit: 5 },
], { deduplicate: true });
for (const memory of result.data) {
console.log(`[${memory.score.toFixed(2)}] ${memory.content}`);
}Deduplication
When deduplicate is enabled (the default), memories that appear in
multiple strategy results are merged. The highest score from any strategy is kept,
and the result indicates which strategies matched.
Deduplication runs server-side so you always get exactly the number of unique results you asked for, regardless of overlap between strategies.