Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds new package (Orama Switch) #782

Merged
merged 2 commits into from
Sep 10, 2024
Merged

feat: adds new package (Orama Switch) #782

merged 2 commits into from
Sep 10, 2024

Conversation

micheleriva
Copy link
Member

@micheleriva micheleriva commented Sep 10, 2024

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
    }
  }
})

Copy link

vercel bot commented Sep 10, 2024

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

@micheleriva micheleriva marked this pull request as ready for review September 10, 2024 01:48
@micheleriva micheleriva merged commit 9160a61 into main Sep 10, 2024
3 checks passed
@micheleriva micheleriva deleted the feat/switch branch September 10, 2024 01:57
}
})

const orama = new Switch(client)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant to pass db here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants