Semantic Search API
If you need more programmatic control than getContext, you can use the search() method.
Raw Vector Search
const results = await ctx.search({
userId: "user_789",
query: "billing issues",
limit: 5
});
Filtering by Metadata
You can provide a filter object to strictly limit the search space using metadata tags you attached during ingestion.
const results = await ctx.search({
userId: "user_789",
query: "billing issues",
limit: 5,
filter: {
source: "support_ticket" // Only search through support tickets
}
});
results.forEach(res => {
console.log(res.score, res.content, res.metadata);
});