oramasearch / orama

🌌 A complete search engine and RAG pipeline in your browser, server or edge network with support for full-text, vector, and hybrid search in less than 2kb.
https://docs.orama.com
Other
8.6k stars 289 forks source link

feat: adds new package (Orama Switch) #782

Closed micheleriva closed 1 month ago

micheleriva commented 1 month ago

With Orama Switch, you can use the same APIs to access either Orama Cloud or Orama OSS.

For instance, this is how you would interact with Orama Cloud:

import { Switch } from '@orama/switch'
import { OramaClient } from '@oramacloud/client'

const client = new OramaClient({
  endpoint: '<Your Orama Cloud Endpoint>',
  api_key: '<Your Orama Cloud API Key>',
})

const orama = new Switch(client)

const results = await orama.search({
  term: 'noise cancelling headphones',
  where: {
    price: {
      lte: 99.99
    }
  }
})

And this is Orama OSS:

import { Switch } from '@orama/switch'
import { create } from '@orama/orama'

const db = await create({
  schema: {
    productName: 'string',
    price: 'number'
  }
})

const orama = new Switch(client)

const results = await orama.search({
  term: 'noise cancelling headphones',
  where: {
    price: {
      lte: 99.99
    }
  }
})
vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orama-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 10, 2024 1:49am