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

Add docs for rest #699

Merged
merged 4 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions packages/docs/cloud/data-sources/custom-integrations/json-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@ outline: deep
With Orama Cloud, you can upload a JSON file as a data source.
Once you upload it to Orama Cloud, it will be distributed in our Global Search Network, making it available in 300 global locations worldwide.

You can follow along with this guide by downloading the following example JSON file: [example dataset](https://docs.oramasearch.com/cloud/guides/json-file/dog_breeds.json)
You can follow along with this guide by downloading the following example JSON file: [example dataset](/cloud/guides/json-file/dog_breeds.json)

## Creating the index

As always, you can create a new Orama Cloud index by going to [https://cloud.oramasearch.com/indexes/new](https://cloud.oramasearch.com/indexes/new).
As always, you can create a new Orama Cloud index by going to [https://cloud.oramasearch.com/indexes](https://cloud.oramasearch.com/indexes).

Once you're there, you will be presented with the following screen:
In this page click on the `Add new index` button and choose: `Import Data from files`.

<ZoomImg
src='/cloud/guides/json-file/orama-cloud-index-creation.webp'
src='/cloud/guides/json-file/1.png'
alt='Orama cloud indexes page'
/>

Once you clicked on `Import Data from files` you will be presented with the following page:

<ZoomImg
src='/cloud/guides/json-file/orama-cloud-index-creation.png'
alt='Create a new JSON File index with Orama Cloud'
/>

Expand Down Expand Up @@ -58,4 +65,4 @@ Now that you have your index deployed, you can start using it in your app.

Orama Cloud provides an official SDK for JavaScript that runs on every JavaScript runtime. You can use it to query your data.

To learn more about the SDK, check out the [documentation](/cloud/integrating-orama-cloud/javascript-sdk).
To learn more about the SDK, check out the [documentation](/cloud/integrating-orama-cloud/javascript-sdk).
49 changes: 48 additions & 1 deletion packages/docs/cloud/data-sources/custom-integrations/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,51 @@ outline: deep

# Connect Orama Cloud to a REST API

Work in progress.
Another way to use Orama and get your data indexed is to import the data using your own REST API.

In this example I will be using a project I created that already has an API endpoint at: [https://letsplayretro.games/api/nes/all](https://letsplayretro.games/api/nes/all?results=999), this particular endpoint gather all the games for the original [Nintendo Entertainment System](https://en.wikipedia.org/wiki/Nintendo_Entertainment_System) into one nice JSON structure.

To start indexing this data let's go into the dashboard and click on `Add a new Index` and then on `HTTP Integrations`:

<ZoomImg
src='/cloud/guides/rest/1.png'
alt='Click on the button saying Add a new index'
/>

You will then will be presented with a page that asks some questions about your new index and like the name and a description that is optional, in my case I named the index it `NES Games` but you may call it anything.
After that is done you can click on `REST API` and we are ready to create our Index:

<ZoomImg
src='/cloud/guides/rest/2.png'
alt='Create a new REST Api index with Orama Cloud'
/>

This page is where we will tell Orama the location of the Endpoint we want it to get the data from, and we want to use the data at [https://letsplayretro.games/api/nes/all](https://letsplayretro.games/api/nes/all?results=999), in our case the endpoint does not require any authorization but if it did this where you could give us a header to send in the request.

The next step is to tell orama where our documents are in the Endpoint's JSON, if you open the endpoint you can see they are all in an array called `games`, so in our path we want to get everything inside of `games`, to represent that in JSONPath we write `$.games.*`.

Final step before we deploy our Index is to specify the properties that Orama should consider when performing a search.
This doesn't mean that these properties will be the only ones returned, but rather that when searching for a specific term like "mario", Orama will only search within these properties.
In our case, we only want to use the `name` property, which is a string. Let's add that and we will be ready to deploy our index:

<ZoomImg
src='/cloud/guides/rest/3.png'
alt='Deploy your index'
/>

After waiting a bit we should get back a success message and our API Key and Endpoint that we can use within our app.

<ZoomImg
src='/cloud/guides/rest/4.png'
alt='Deployed index'
/>

That's it! We have deployed an index with a REST API datasource

## Integrating Orama Cloud into your app

Now that you have your index deployed, you can start using it in your app.

Orama Cloud provides an official SDK for JavaScript that runs on every JavaScript runtime. You can use it to query your data.

To learn more about the SDK, check out the [documentation](/cloud/integrating-orama-cloud/javascript-sdk).
15 changes: 12 additions & 3 deletions packages/docs/cloud/data-sources/native-integrations/docusaurus.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,23 @@ plugins: [

To get this variables first create a new integration for HTTP Integrations in here:

![select integrations](/oss/docussarus-1.png)
<ZoomImg
src='/oss/docussarus-1.png'
alt='select integrations'
/>

And then docusaurus:

![select Docusaurus](/oss/docussarus-2.png)
<ZoomImg
src='/oss/docussarus-2.png'
alt='Select Docusaurus'
/>

On the next page you will see all the variables you need to get you up and running:

![the variables](/oss/docussarus-3.png)
<ZoomImg
src='/oss/docussarus-3.png'
alt="the variables"
/>

And you are set, if you set deploy to true your index will update whenever you build the website and there are changes to your pages.
15 changes: 12 additions & 3 deletions packages/docs/open-source/plugins/plugin-docusaurus.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,23 @@ plugins: [

To get this variables first create a new integration for HTTP Integrations in here:

![select integrations](/oss/docussarus-1.png)
<ZoomImg
src='/oss/docussarus-1.png'
alt='select integrations'
/>

And then docusaurus:

![select Docusaurus](/oss/docussarus-2.png)
<ZoomImg
src='/oss/docussarus-2.png'
alt='Select Docusaurus'
/>

On the next page you will see all the variables you need to get you up and running:

![the variables](/oss/docussarus-3.png)
<ZoomImg
src='/oss/docussarus-3.png'
alt="the variables"
/>

And you are set, if you set deploy to true your index will update whenever you build the website and there are changes to your pages.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
112 changes: 112 additions & 0 deletions packages/docs/public/cloud/guides/json-file/dog_breeds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
[
{
"breed": "Labrador Retriever",
"breedType": "Purebred",
"origin": "Canada,USA",
"popularity": "1",
"temperament": ["Cheerful", "Gentle", "Friendly", "Intelligent"],
"hypoallergenic": "No",
"intelligence": 7,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "German Shepard",
"breedType": "Purebred",
"origin": "Germany",
"popularity": "2",
"temperament": ["Corageous", "Intelligent", "Loyal", "Watchful"],
"hypoallergenic": "No",
"intelligence": 3,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "Golden Retriever",
"breedType": "Purebred",
"origin": "United Kingdom",
"popularity": "3",
"temperament": ["Intelligent", "Kind", "Friendly", "Confident"],
"hypoallergenic": "No",
"intelligence": 4,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "French Bulldog",
"breedType": "Purebred",
"origin": "France, UK",
"popularity": "4",
"temperament": ["Playful", "Sociable", "Friendly", "Lively", "Patient"],
"hypoallergenic": "No",
"intelligence": 58,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "Bulldog",
"breedType": "Purebred",
"origin": "United Kingdom",
"popularity": "5",
"temperament": ["Friendly", "Docile", "Willful", "Gregarious"],
"hypoallergenic": "No",
"intelligence": 77,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "Beagle",
"breedType": "Purebred",
"origin": "United Kingdom",
"popularity": "6",
"temperament": ["Gentle", "Intelligent", "Even Tempered", "Determined"],
"hypoallergenic": "No",
"intelligence": 72,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "Poodle",
"breedType": "Purebred",
"origin": "Germany, France",
"popularity": "7",
"temperament": ["Intelligent", "Faithful", "Trainable", "Instinctual"],
"hypoallergenic": "Yes",
"intelligence": 2,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "Rottweiler",
"breedType": "Purebred",
"origin": "Germany",
"popularity": "8",
"temperament": ["Intelligent", "Corageous", "Fearless", "Confident"],
"hypoallergenic": "No",
"intelligence": 9,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "German Shorthaired Pointer",
"breedType": "Purebred",
"origin": "Germany",
"popularity": "9",
"temperament": ["Intelligent", "Trainable", "Boisterous", "Cooperative"],
"hypoallergenic": "No",
"intelligence": 9,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "Yorkshire Terrier",
"breedType": "Purebred",
"origin": "United Kingdom",
"popularity": "10",
"temperament": ["Independent", "Intelligent", "Corageous", "Confident"],
"hypoallergenic": "Yes",
"intelligence": 27,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
},
{
"breed": "Boxer",
"breedType": "Purebred",
"origin": "Germany",
"popularity": "11",
"temperament": ["Playful", "Friendly", "Devoted", "Loyal"],
"hypoallergenic": "No",
"intelligence": 48,
"photo": "https://learnwebcode.github.io/json-example/images/cat-2.jpg"
}
]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file added packages/docs/public/cloud/guides/rest/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/public/cloud/guides/rest/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/public/cloud/guides/rest/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/docs/public/cloud/guides/rest/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading