General Introduction
Orama is an open source, high-performance search engine written entirely in TypeScript with support for full-text search, vector search, and hybrid search.Orama is designed to work in any JavaScript runtime environment, providing fast, reliable search functionality. It is designed to be lightweight (less than 2KB) , but powerful for a variety of application scenarios , including browsers , servers and edge networks.Orama provides a rich set of features , such as full-text search , vector search , hybrid search , geographic search , spelling tolerance and multi-language support , etc., to meet the needs of a variety of search needs from small projects to large enterprise applications .
Function List
- Full text search: Supports fast and accurate full-text searches of text content.
- vector search: Supports vector-based search for non-textual data such as images and audio.
- Hybrid Search: Combining full-text and vector searches to provide more comprehensive search results.
- high performance: Optimized search algorithms to ensure fast response despite large data volumes.
- expand one's financial resources: Fully open source, allowing users to customize and expand as needed.
- non-dependent: No external dependencies are required, simplifying installation and use.
- Multi-platform support: Compatible with various JavaScript runtime environments, including Node.js and browsers.
- Geographic search: Supports location-based search functionality.
- spelling tolerance: Provide spelling error tolerance to enhance the search experience.
- Multi-language support: Supports stemming and tokenization in 30 languages.
Using Help
mounting
Orama can be installed using npm, yarn or pnpm. Here are the steps for installing with npm:
- Open a terminal or command line tool.
- Run the following command to install Orama:
npm install @orama/orama
- Once the installation is complete, you can introduce Orama into your project:
import { create, insert, search } from '@orama/orama' ;
utilization
Creating Indexes
- Create a new index:
const db = create({
schema: {
name: 'string',
description: 'string', price: 'number', embedding: 'vector[1536]', }
embedding: 'vector[1536]', meta: {
meta: {
rating: 'number',
}, }
}, }
}).
- Add documents to the index:
insert(db, {
name: 'Noise cancelling headphones', description: 'Best noise cancelling headphones on the market', {
description: 'Best noise cancelling headphones on the market',
embedding: [0.2432, 0.9431, 0.5322, 0.4234, ...] ,
meta: { rating: 4.5 }, }
}).
- Perform a search:
const results = search(db, { term: 'Best headphones' }); console.log(results); console.log(results, { term: 'Best headphones' })
console.log(results);
vector search
- Creates a vector index:
const vectorIndex = create({
schema: {
name: 'string',
embedding: 'vector[1536]',
},
});
- Adds the vector to the index:
insert(vectorIndex, {
name: 'Sample vector',
embedding: [0.1, 0.2, 0.3, ...] ,
}).
- Performs a vector search:
const vectorResults = search(vectorIndex, {
term: 'Sample vector', mode: 'vector', {
}); console.log(vectorResults);
console.log(vectorResults);
Advanced Features
Orama also offers a number of advanced features such as customized data import, quality checks, analysis tools and security configurations. Users can configure them as needed to optimize the search experience.
Sample Projects
Orama has been used by several well-known websites such as nodejs.org, jsr.io, and tanstack.com, which process millions of queries per day, demonstrating the power and reliability of Orama.