Skip to content
This repository was archived by the owner on Sep 6, 2026. It is now read-only.

Repository files navigation

Retired 2026-09. Flapjack is Algolia-compatible: use the official Algolia client for your language (algoliasearch for JavaScript, InstantSearch.js/React/Vue, algoliasearch-client-* elsewhere) pointed at your Flapjack host. Source history: https://github.com/flapjackhq/flapjack/tree/sdks-retired-2026-09

Flapjack Search Ruby SDK

A fully-featured Ruby API client for Flapjack Search. Drop-in replacement for the algolia gem.

Installation

Add to your Gemfile:

gem 'flapjack-search', '~> 0.1.0.pre.beta.1'

Or install directly:

gem install flapjack-search --pre

Quick Start

require 'flapjack'

# Cloud usage (same API as Algolia)
client = Flapjack::SearchClient.create('YOUR_APP_ID', 'YOUR_API_KEY')

# Self-hosted Flapjack server
hosts = [
  Flapjack::Transport::StatefulHost.new(
    'localhost',
    protocol: 'http://',
    port: 7700,
    accept: CallType::READ | CallType::WRITE
  )
]
config = Flapjack::Configuration.new('your-app-id', 'your-api-key', hosts, 'Search')
client = Flapjack::SearchClient.create_with_config(config)

# Index documents
client.save_objects('movies', [
  { objectID: '1', title: 'The Matrix', year: 1999, genre: 'sci-fi' },
  { objectID: '2', title: 'Inception', year: 2010, genre: 'sci-fi' },
])

# Search
results = client.search(
  Flapjack::Search::SearchMethodParams.new(
    requests: [
      Flapjack::Search::SearchForHits.new(index_name: 'movies', query: 'matrix')
    ]
  )
)

puts results.results[0].hits[0].additional_properties['title']
# => "The Matrix"

Features

  • Full Algolia Search API compatibility
  • Self-hosted Flapjack server support via custom hosts
  • Typed model objects with OpenAPI-generated classes
  • Automatic retry with host failover
  • Synonym and query rule management
  • Faceted search and filtering
  • Browse/cursor-based pagination

Migrating from Algolia

See MIGRATION.md for a step-by-step guide.

Key changes:

  • gem 'algolia' becomes gem 'flapjack-search'
  • require 'algolia' becomes require 'flapjack'
  • Algolia::SearchClient becomes Flapjack::SearchClient
  • AlgoliaError becomes FlapjackError
  • Wire protocol (x-algolia-* headers) unchanged for compatibility

Requirements

  • Ruby >= 2.6
  • Flapjack server (self-hosted) or Flapjack Cloud account

License

MIT

About

Flapjack Search Ruby SDK — drop-in replacement for the algolia gem

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages