Orama full-text search over in-memory documents: working versions (tested 2026-10-15)
Create an @orama/orama schema, insert documents, and run full-text search with term matching offline.
passed2 passed · 0 failed2026-10-15 20:57 UTC- Status
- passed
- Last passed
- 2026-10-15 20:57 UTC
- Tests
- 2 / 2
- Language
- TypeScript
- Runtime
- node v22.23.3
pinned versions3
@orama/orama@3.1.18@types/node@26.6.5tsx@4.23.15
run it
npm install --no-audit --no-fund --ignore-scripts=false npm test
test environment
node v22.23.3 linux 6.17.0-1022-azure x64 runner: github-actions 38805962781
The code
Exactly the files that passed. Your agent can pull them with get_recipe("orama-fulltext-search") (install), or see them on GitHub.
package.json
{
"name": "orama-fulltext-search",
"private": true,
"type": "module",
"scripts": {
"test": "node --import tsx --test test/*.test.ts"
},
"dependencies": {
"@orama/orama": "3.1.18"
},
"devDependencies": {
"@types/node": "26.6.5",
"tsx": "4.23.15"
}
}
src/search.ts
import { create, insert, search } from "@orama/orama";
export type Doc = { id: string; title: string; body: string };
export async function buildIndex(docs: Doc[]) {
const db = await create({
schema: {
id: "string",
title: "string",
body: "string",
} as const,
});
for (const doc of docs) await insert(db, doc);
return db;
}
export async function find(db: Awaited<ReturnType<typeof buildIndex>>, term: string) {
const result = await search(db, { term, properties: ["title", "body"] });
return result.hits.map((h) => h.document as Doc);
}
test/search.test.ts
import { test } from "node:test";
import assert from "node:assert/strict";
import { buildIndex, find } from "../src/search.ts";
test("indexes and finds by title term", async () => {
const db = await buildIndex([
{ id: "1", title: "Alpine hiking boots", body: "Waterproof trail shoes" },
{ id: "2", title: "Kitchen blender", body: "High speed smoothie maker" },
]);
const hits = await find(db, "hiking");
assert.equal(hits.length, 1);
assert.equal(hits[0].id, "1");
});
test("finds body matches", async () => {
const db = await buildIndex([
{ id: "a", title: "Mixer", body: "smoothie maker for fruit" },
{ id: "b", title: "Saw", body: "wood cutting tool" },
]);
const hits = await find(db, "smoothie");
assert.equal(hits.length, 1);
assert.equal(hits[0].id, "a");
});
Connect to ProvenPin
Add the free MCP server so your agent can pull this recipe and others like it. Same setup as the docs.
terminal
claude mcp add --transport http provenpin https://mcp.provenpin.com/mcp
~/.cursor/mcp.json
{ "mcpServers": { "provenpin": { "url": "https://mcp.provenpin.com/mcp" } } }.vscode/mcp.json
{ "servers": { "provenpin": { "type": "http", "url": "https://mcp.provenpin.com/mcp" } } }~/.codeium/windsurf/mcp_config.json
{ "mcpServers": { "provenpin": { "serverUrl": "https://mcp.provenpin.com/mcp" } } }MCP settings
{ "mcpServers": { "provenpin": { "type": "streamableHttp", "url": "https://mcp.provenpin.com/mcp" } } }Any other MCP client: Streamable HTTP at https://mcp.provenpin.com/mcp. No API key, no signup.