Skip to main content

Semantic Document Search

This example proves how easy it is to replace complex search infrastructure (like Elasticsearch or Algolia) with Jabrod’s native vector search capabilities.

Architecture

Traditional search engines match keywords. Semantic search understands intent.

SDK Implementation

The core of this example is the queryBuilder, which provides a fluent API for searching knowledge bases.

1. Ingesting Content

We upload purely text content. Jabrod automatically splits this into searchable segments.
await client.kb.uploadText({
    kbName: 'docs-v1',
    content: documentText,
    metadata: { title: 'User Guide', version: '2.0' }
});

2. Searching

Instead of complex query DSLs, we just pass the natural language query.
const results = await client.rag.queryBuilder()
    .withKB('docs-v1')
    .withQuery("how to fix payment errors")
    .withLimit(5) // Get top 5 matches
    .execute();

3. Displaying Results

The results contain the content snippet and the relevance score (0-1).
results.forEach(match => {
    console.log(`Relevance: ${match.score}`);
    console.log(match.content);
});

Why it’s better

  1. No synonyms needed: “Billing” matches “Payment” automatically.
  2. No infrastructure: No vector DB to manage.
  3. Fast setup: Literal drag-and-drop of text.