Create your Orama schema following the official specification.
You can install the package using npm
, yarn
or pnpm
:
npm i orama-schema-resolver
yarn add orama-schema-resolver
pnpm add orama-schema-resolver
import { create, insert, search } from '@oramasearch/orama';
import resolveSchema from 'orama-schema-resolver';
import * as fs from 'fs';
// You can parse data from any source, but we'll use a local file for this example
const data = JSON.parse(fs.readFileSync('./package.json').toString());
const schema = resolveSchema(data);
const db = create({ schema })
insert(db, data);
const results = search(db, {
term: 'orama'
});
console.log(results)