Orama Search Engine Documentation

repository·main·Indexed 27 days ago

https://github.com/oramasearch/orama

A high-performance, extensible search engine and RAG pipeline supporting full-text, vector, and hybrid search. Designed for browsers, Node.js, and Deno, Orama includes a robust plugin system for embeddings, analytics, data persistence, and integrations with frameworks like Astro, Docusaurus, and Nextra.

Tokens
25.9K
Snippets
89
Records
182
Agent score
94%

What's inside Orama

  1. Create a new docs version in Docusaurus

    main

    To release a specific version of your documentation (e.g., version 1.0), use the Docusaurus CLI command. This action copies your current docs folder into a new directory under versioned_docs/version-1.0 and updates versions.json.

    After running this command, your site will have two distinct paths:

    • The versioned docs (e.g., 1.0) at /docs/.
    • The current (upcoming/unreleased) docs at /docs/next/.
    npm run docusaurus docs:version 1.0
  2. Install @orama/plugin-embeddings

    main

    Install the Orama Embeddings plugin via npm. Note that you must also install a TensorFlowJS backend for the plugin to function.

    Required Backend Installation:

    • For Browser environments: @tensorflow/tfjs-backend-webgl is highly recommended.
    • For Node.js environments: @tensorflow/tfjs-node is recommended.

    Other supported backends include @tensorflow/tfjs, @tensorflow/tfjs-backend-cpu, @tensorflow/tfjs-node-gpu, and @tensorflow/tfjs-backend-wasm.

    npm i @orama/plugin-embeddings
    # And install a backend, e.g., for Node.js:
    npm i @tensorflow/tfjs-node
  3. Update existing versioned docs

    main

    To edit content for specific versions, modify the files within their respective directories:

    • Versioned content: Edit files in versioned_docs/version-<version_name>/ to update that specific version's URL (e.g., http://localhost:3000/docs/hello).
    • Current/Unreleased content: Edit files in the docs/ folder to update the next version (e.g., http://localhost:3000/docs/next/hello).
  4. Enable stemming for a language in Orama

    main

    Orama supports stemming to optimize queries and save indexing space. To enable stemming, you must configure the tokenizer within your schema to include stemming: true, the specific stemmer function, and the language constant imported from the corresponding language package (e.g., @orama/stemmers/italian).

    Note: Chinese (Mandarin) and Japanese are not supported via stemming; they require dedicated tokenizers (@orama/tokenizers) and stop-word removal (@orama/stopwords).

    import { create } from '@orama/orama'
    import { stemmer, language } from '@orama/stemmers/italian'
    
    const db = create({
      schema: {
      components: {
        tokenizer: {
          stemming: true,
          stemmer,
          language
        }
      }
    })
  5. Use Front Matter in Markdown documents

    main

    You can add metadata to the top of your Markdown files using Front Matter. This metadata is enclosed in triple dashes (---) and can define properties like id, title, description, and slug.

    ---
    id: my-doc-id
    title: My document title
    description: My document description
    slug: /my-custom-url
    ---
    
    ## Markdown heading
    
    Markdown text with [links](./hello.md)