/rails7-search

Rails 7 with Search 🌟

Primary LanguageRubyMIT LicenseMIT

README

Hi! This is an example Rails 7 app using OpenSearch with Stimulus and Turbo for a very basic book search.

Quick Setup

First, make sure you have homebrew downloaded:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

To get setup, run these scripts:

  1. bin/setup
  2. bin/setup-database

Ruby Version & Dependencies

We are currently using Ruby 3.1.2

Our setup script uses rbenv to manage our ruby version. We install rbenv (and other dependencies) using Homebrew.

The ruby version is locked in the .ruby-version, which rbenv consumes.

Databases

If you haven't already, run bin/setup-database. Otherwise, you can do it manually using the rake tasks, such as:

run rake db:setup

Setting Up Search

Provision an OpenSearch cluster, grab your URL, and put it in your env:

BONSAI_URL=https://username:password@opensearch-example-r-1234567890.us-west-1.bonsaisearch.net:443

You can do this two ways:

  1. Provision a hobby cluster on bonsai.io
  2. Download OpenSearch and serve it locally

If the second, there are a few options:

  1. Download directly from opensearch.org - they have
  2. Install with Hombrew:
brew install opensearch

When this is done, index your models with: