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',
})
Advanced search
const results = await client.search({
term: 'red leather shoes',
where: {
price: {
lte: 9.99
},
gender: 'unisex'
},
limit: 5,
offset: 1
})
With React
import { useOramaCloud } from '@oramacloud/client/react'
export function MyComponent() {
const { useSearch } = useOramaCloud({
endpoint: '<Your Orama Cloud Endpoint>',
api_key: '<Your Orama Cloud API Key>'
})
const { results } = useSearch({
term: 'red leather shoes'
})
return (
<>
{results.hits.map((hit) => (
<div key={hit.id}>
<p>{hit.document.property}</p>
</div>
))}
</>
)
}