Skip to content

Commit

Permalink
Update docs for multi index search (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
matijagaspar authored Nov 7, 2024
2 parents 2bfbf2d + 40e217a commit 6ad168d
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/docs/config/menu/orama-cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ const oramaCloudMenu = [
{
label: 'Hybrid search',
link: '/cloud/performing-search/hybrid-search'
}
},
{
label: "Multi-index search",
link: "/cloud/performing-search/multi-index-search.html",
badge: {
text: "New",
variant: "success"
}
},
]
},
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: Performing search across multiple indexes on Orama Cloud
description: Learn how to perform search across multiple indexes on Orama Cloud.
---
import { Aside } from '@astrojs/starlight/components';
import { Tabs, TabItem } from '@astrojs/starlight/components';

After deploying your index, Orama will distribute it to over 300 global points of presence across more than 100 countries worldwide. This will guarantee the lowest possible latency for any search query, at any scale.

At the time of this writing, you can execute search queries using our official JavaScript SDK.

This SDK manages connection, cache, telemetry, and type safety for all your search operations. It is the official method for communicating with Orama Cloud.

<Aside type="tip" title='Installing the Orama SDK'>
You can find the guide on installing the SDK [here](/cloud/integrating-orama-cloud/javascript-sdk).
</Aside>

Make sure you have the Orama SDK installed to start performing full-text, vector, and hybrid search at a massive scale!

## Seach across multiple indexes deployed on Orama Cloud

<Aside type="caution" title='Experimental feature'>
This is feature is still in expermintal phase and only available for JavaScript SDK.
</Aside>

Once you have your SDK for your preferred language installed, you can start performing search across multiple indexes deployed on Orama Cloud.

The client exposes a simple `search` method that can be used to query the index. Read the full documentation [here](/cloud/performing-search/full-text-search)

### Search across multiple indexes

<Tabs syncKey="sdk">
<TabItem label="JavaScript" icon="seti:javascript">
```typescript
import { OramaClient } from "@oramacloud/client";

const client = new OramaClient({
mergeResults: false
indexes:[
{api_key: "<Your Orama Cloud API Key index 1>", endpoint:"<Your Orama Cloud Endpoint index 1>"},
{api_key: "<Your Orama Cloud API Key index 2>", endpoint:"<Your Orama Cloud Endpoint index 2>"},
]
});

const results = await client.search({
term: "red shoes",
mode: "fulltext", // optional, default is "fulltext" but can also be "vector" or "hybrid"
});
```
</TabItem>
</Tabs>

### Result
This will return an array of search results from both indexes.

```json
[
{
"elapsed": ...,
"count": ...,
"hits": { ... },
},
{
"elapsed": ...,
"count": ...,
"hits": { ... },
}
]
```

If `mergeResults` is set to `true`, the results will be merged into a single results.

```json
{
"elapsed": ...,
"count": ...,
"hits": { ... },
}
```

<Aside type="caution" title="Limitations">
Due to the nature of multi index search grouping (`groupBy`) is not supported.
</Aside>




0 comments on commit 6ad168d

Please sign in to comment.