From 70ff2dbb584c5a9c28ea7ba47302dab7816958c8 Mon Sep 17 00:00:00 2001 From: matijagaspar Date: Thu, 7 Nov 2024 12:35:34 +0100 Subject: [PATCH] chore: update docs for multi index search --- packages/docs/config/menu/orama-cloud.ts | 10 ++- .../performing-search/multi-index-search.mdx | 87 +++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 packages/docs/src/content/docs/cloud/performing-search/multi-index-search.mdx diff --git a/packages/docs/config/menu/orama-cloud.ts b/packages/docs/config/menu/orama-cloud.ts index 6f2aff66e..77ba437b9 100644 --- a/packages/docs/config/menu/orama-cloud.ts +++ b/packages/docs/config/menu/orama-cloud.ts @@ -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: "Experimental", + variant: "caution" + } + }, ] }, { diff --git a/packages/docs/src/content/docs/cloud/performing-search/multi-index-search.mdx b/packages/docs/src/content/docs/cloud/performing-search/multi-index-search.mdx new file mode 100644 index 000000000..d64768680 --- /dev/null +++ b/packages/docs/src/content/docs/cloud/performing-search/multi-index-search.mdx @@ -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. + + + +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 + + + +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 + + + + ```typescript + import { OramaClient } from "@oramacloud/client"; + + const client = new OramaClient({ + mergeResults: false + indexes:[ + {api_key: "", endpoint:""}, + {api_key: "", endpoint:""}, + ] + }); + + const results = await client.search({ + term: "red shoes", + mode: "fulltext", // optional, default is "fulltext" but can also be "vector" or "hybrid" + }); + ``` + + + +### 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": { ... }, + } + ``` + + + + + +