Skip to content

appbaseio/reactivesearch-realm-function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jul 20, 2022
d0f550d · Jul 20, 2022
Oct 28, 2021
Apr 12, 2022
Feb 28, 2022
Jul 20, 2022
Apr 12, 2022
Aug 20, 2021
Sep 14, 2021
Aug 16, 2021
Aug 16, 2021
Oct 7, 2021
Oct 7, 2021
Oct 7, 2021
Jul 20, 2022
Jun 25, 2022
Oct 14, 2021
Oct 14, 2021
Oct 12, 2021
Jun 25, 2022
Jun 25, 2022
Sep 15, 2021
Sep 15, 2021
Jun 25, 2022
Aug 25, 2021
Sep 24, 2021

Repository files navigation

ReactiveSearch Realm Function

The ReactiveSearch Realm project deploys the ReactiveSearch API as a transpiled JS code into a Realm function. The goal of this project is to enable Atlas Search users to be able to build search UIs using Searchbox and ReactiveSearch UI libraries.

Note on current project status: This project is being actively developed and currently in a MVP stage where Atlas Search users can deploy the Realm function and run it with the React Searchbox library. Follow the below guides to get started and test this.

Setup

  • Clone repo: git clone https://github.com/appbaseio/reactivesearch-realm-function.git
  • Change working dir: cd reactivesearch-realm-function
  • Install dependencies: npm i
  • Start local build with hot reload: npm start
  • Test local build: npm run start:test

Local Testing

  • Add valid env cp .env.sample .env

  • Update env variables in .env file. DB_URL and DB_NAME are the required env

  • Start local server npm run dev

  • Local server exposes 2 endpoints to test the functionality

    • /:collection_name/_reactivesearch -> Endpoint to execute rs query and get mongo response. Sample output {data: []}. collection_name is dynamic param that one can pass against which query is to be executed
    • /:collection_name/_reactivesearch/validate -> Endpoint to validate rs query and get the aggregation pipleline in response.
  • Make curl / rest request

    curl --location --request POST 'http://localhost:8080/_reactivesearch' \
      --header 'Content-Type: application/json' \
      --data-raw '{
          "query": [{
              "id": "search",
              "type": "search",
              "dataField": "*",
              "size": 5
          }],
          "mongodb": {
              "db": "sample_airbnb",
              "collection": "listingsAndReviews"
          }
      }'

Deploy Project

Go over the steps to deploy this project over here.

Static UI hosting

Go over the steps to deploy the search UI with MongoDB App Services over here.