Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@oramacloud/client

Package Overview
Dependencies
Maintainers
4
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@oramacloud/client

Orama SDK for Node.js, Deno, and Browsers

  • 1.0.0-beta.22
  • npm
  • Socket score

Version published
Weekly downloads
2K
decreased by-6.86%
Maintainers
4
Weekly downloads
 
Created
Source

Orama Cloud Client

Install

npm i @oramacloud/client

Usage

import { OramaClient } from '@oramacloud/client'

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

const results = await client.search({
  term: 'red leather shoes',
})
const results = await client.search({
  term: 'red leather shoes',
  where: {
    price: {
      lte: 9.99
    },
    gender: 'unisex'
  },
  limit: 5,
  offset: 1
})

With React

import { OramaCloud, useSearch } from '@oramacloud/client/react'

export function App() {
  return (
    <OramaCloud endpoint='<Your Orama Cloud Endpoint>' apiKey='<Your Orama Cloud API Key>'>
      <Search />
    </OramaCloud>
  )
}

function Search() {
  const { results, error } = useSearch({
    term: 'red leather shoes',
    limit: 10,
    offset: 5
  })

  return (
    <>
      {results.hits.map((hit) => {
        <div key={hit.id}>
          <p> {hit.document.myCustomProperty} </p>
        </div>
      })}
    </>
  )
}

With Vue

Set up Orama Cloud singleton

Create a orama.ts file in the src folder to create a Orama Cloud Client instance that you’ll use throughout your application.

import { OramaCloud } from '@oramacloud/client/vue'

export const orama = new OramaCloud({
  apiKey: '<Your Orama Cloud API Key>',
  endpoint: '<Your Orama Cloud Endpoint>'
})

Use the client instance in your component

<template>
  <li v-for="hit in searchResults?.hits" :key="hit.id">
    {{ hit.id }}
  </li>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { orama } from './orama'

const searchResults = ref(null)

onMounted(async () => {
  if (orama) {
    const { results, error } = await orama.search({
      term: 'guitar',
      limit: 5
    })

    searchResults.value = results
  }
})
</script>

Keywords

FAQs

Package last updated on 07 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc