- Ruby 3.1+ and Rails 6.1+ in your host app
- A reachable Typesense node (host/port/protocol); default port is 8108
TYPESENSE_API_KEYset in your environment (never commit secrets)- An existing Typesense collection and schema; see Schema
Run installer
config/initializers/search_engine.rb.See Generators & Console helpers for more details.Configure the initializer
host/port/protocol: where your Typesense node is reachable; defaults are safe for localhost.api_key: read fromENV.fetch(“TYPESENSE_API_KEY”)so secrets never live in code.default_query_by: default fields used when you do not passquery_byexplicitly.
Define a minimal model
books collection exists with at least id (int64) and title (string).You can also use a Generator to create a new model:app/models/search_engine/book.rb.Index data (optional convenience)
Rebuild a partition directly (optional)
For one-off reindexing by key, call the model-level helper:See Indexer → Partitioning for the partitioning DSL.
Request flow
Next steps
- Multi‑search: run multiple searches in one network call.
- JOINs: join related collections and select nested fields.
- Grouping: group results and aggregate with counts.
Troubleshooting
- Missing
TYPESENSE_API_KEY: set the ENV var before boot; see Configuration → ENV mapping. Tip: the CLI doctor checks this. - Connection refused or timeout: verify
host/port/protocol; see the CLI → Doctor. - Unknown field errors: declare attributes on the model or adjust selection; see Field selection → Guardrails.
Related links
- Installation
- Configuration
- Client
- Observability — events, logging subscriber, OpenTelemetry
- DX — helpers:
dry_run!,to_params_json,to_curl - Relation — chaining DSL used above