• Stars
    star
    1,620
  • Rank 27,719 (Top 0.6 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 16 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sphinx/Manticore plugin for ActiveRecord/Rails

Thinking Sphinx

Thinking Sphinx is a library for connecting ActiveRecord to the Sphinx full-text search tool, and integrates closely with Rails (but also works with other Ruby web frameworks). The current release is v5.5.1.

Upgrading

Please refer to the changelog and release notes for any changes you need to make when upgrading. The release notes in particular are quite good at covering breaking changes and more details for new features.

The documentation also has more details on what’s involved for upgrading from v4 to v5, v3 to v4, and v1/v2 to v3.

Installation

It’s a gem, so install it like you would any other gem. You will also need to specify the mysql2 gem if you’re using MRI, or jdbc-mysql if you’re using JRuby:

gem 'mysql2',          '~> 0.4',    :platform => :ruby
gem 'jdbc-mysql',      '~> 5.1.35', :platform => :jruby
gem 'thinking-sphinx', '~> 5.5'

The MySQL gems mentioned are required for connecting to Sphinx, so please include it even when you’re using PostgreSQL for your database.

You’ll also need to install Sphinx – this is covered in the extended documentation.

Usage

Begin by reading the quick-start guide, and beyond that, the documentation should serve you pretty well.

Requirements

The current release of Thinking Sphinx works with the following versions of its dependencies:

Library Minimum Tested Against
Ruby v2.4 v2.4, v2.5, v2.6, v2.7, v3.0, v3.1, v3.2
Sphinx v2.2.11 v2.2.11, v3.4.1
Manticore v2.8 v4.0, v6.0
ActiveRecord v4.2 v4.2..v7.0

It might work with older versions of Ruby, but it’s highly recommended to update to a supported release.

It should also work with JRuby, but the test environment for that in CI has been unreliable, hence that’s not actively tested against at the moment.

Sphinx or Manticore

If you’re using Sphinx, v2.2.11 is recommended even though it’s quite old, as it works well with PostgreSQL databases (but if you’re using MySQL – or real-time indices – then v3.3.1 should also be fine).

If you’re opting for Manticore instead, v2.8 or newer works, but v4 or newer is recommended as that’s what is actively tested against. The v4.2 and 5.0 releases had bugs with facet searching, but that’s been fixed in Manticore v6.0.

Rails and ActiveRecord

Currently Thinking Sphinx is built to support Rails/ActiveRecord 4.2 or newer. If you’re using Sinatra and ActiveRecord instead of Rails, that’s fine – just make sure you add the :require => 'thinking_sphinx/sinatra' option when listing thinking-sphinx in your Gemfile.

If you want ActiveRecord 3.2-4.1 support, then refer to the 4.x releases of Thinking Sphinx. Or, for ActiveRecord 3.1 support, then refer to the 3.0.x releases. Anything older than that, then you’re stuck with Thinking Sphinx v2.x (for Rails/ActiveRecord 3.0) or v1.x (Rails 2.3). Please note that these older versions are no longer actively supported.

Ruby

You’ll need either the standard Ruby (v2.4 or newer) or JRuby (9.1 or newer).

Database Versions

MySQL 5.x and Postgres 8.4 or better are supported.

Contributing

Please note that this project has a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

To contribute, clone this repository and have a good look through the specs – you’ll notice the distinction between acceptance tests that actually use Sphinx and go through the full stack, and unit tests (everything else) which use liberal test doubles to ensure they’re only testing the behaviour of the class in question. I’ve found this leads to far better code design.

All development is done on the develop branch; please base any pull requests off of that branch. Please write the tests and then the code to get them passing, and send through a pull request.

In order to run the tests, you’ll need to create a database named thinking_sphinx:

# Either fire up a MySQL console:
mysql -u root
# OR a PostgreSQL console:
psql
# In that console, create the database:
CREATE DATABASE thinking_sphinx;

You can then run the unit tests with rake spec:unit, the acceptance tests with rake spec:acceptance, or all of the tests with just rake. To run these with PostgreSQL, you’ll need to set the DATABASE environment variable accordingly:

DATABASE=postgresql rake

Licence

Copyright © 2007-2022, Thinking Sphinx is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to all who have contributed patches.

More Repositories

1

combustion

Simple, elegant testing for Rails Engines
Ruby
674
star
2

gutentag

A good, simple, solid tagging extension for ActiveRecord.
Ruby
473
star
3

riddle

Ruby Client API for Sphinx
Ruby
136
star
4

ts-delayed-delta

Manage delta indexes via Delayed Job for Thinking Sphinx
Ruby
73
star
5

thinking-sphinx-raspell

An add-on gem for spelling suggestions in Thinking Sphinx
Ruby
58
star
6

ts-datetime-delta

Manage delta indexes via datetime columns for Thinking Sphinx
Ruby
45
star
7

fakeweb-matcher

An RSpec matcher for the Fakeweb HTTP stubbing library
Ruby
37
star
8

sliver

A super simple, extendable Rack API.
Ruby
31
star
9

calendav

Interact with CalDAV via Ruby
Ruby
30
star
10

sphinx

Free open-source SQL full-text search engine
C++
26
star
11

active-matchers

Helpful rspec matchers for testing validations and associations.
Ruby
23
star
12

ginger

Run specs/tests multiple times through different gem versions
Ruby
22
star
13

render_api

Ruby interface for the render.com API.
Ruby
19
star
14

pat.github.com

HTML
17
star
15

railscamps.com

Rails Camps Website
HTML
15
star
16

pedantic

Pares text down to the words that matter
Ruby
14
star
17

pippin

A PayPal Rails Engine that handles IPNs
Ruby
14
star
18

drumknott-server

Server for storing static site search data.
Ruby
11
star
19

gyoza

Streamlined Editing for GitHub Pages
JavaScript
11
star
20

support-act

Encouraging people to buy albums alongside their streaming, to better support artists.
Ruby
11
star
21

not-a-mock

A cleaner and DRYer alternative to mocking and stubbing with RSpec.
Ruby
10
star
22

laughtrack

A festival buzz tracker
Ruby
10
star
23

joiner

Builds ActiveRecord joins from association paths
Ruby
7
star
24

numbr5

Thank-you bot for IRC (and maybe more)
Ruby
7
star
25

sphinx-tute

Project for the Sphinx Tutorial at RailsConf 2009
Ruby
6
star
26

sslocal-rb

Make local environment SSL as streamlined as possible.
Ruby
6
star
27

ruby-netcdf

Copy of source for ruby-netcdf gem, with tweak for MRI 2.0.0
C
6
star
28

enkoder

An extension to the Rails TextHelper module that can be used to protect email addresses (or other information) by obfuscating them using JavaScript code. Written by Dan Benjamin.
Ruby
6
star
29

nudge

Simple Static Site Deployer via Git
Ruby
6
star
30

radiant-tiny-mce

Tiny MCE Filter and Asset Management (via Paperclipped)
5
star
31

tramampoline

Trampoline Website, now with registrations
HTML
5
star
32

thin-glazed

SSL Proxy for HTTP Thin servers
Ruby
5
star
33

ts-sidekiq-delta

Thinking Sphinx - Sidekiq Deltas
Ruby
5
star
34

gzipped_tar

In-memory reading/writing of .tar.gz files
Ruby
5
star
35

radiant-layout-layer

Automatically create Radiant layouts based on HTML files in other extensions
Ruby
5
star
36

inkan

Unique file markers for tracking whether files have been changed.
Ruby
4
star
37

vcr_assistant

Manages VCR cassettes and set-up logic for RSpec.
Ruby
4
star
38

beer-tracker

Website/API partner for Numbr5
3
star
39

chargify-loops

A Rails Engine for Chargify Webhooks
Ruby
3
star
40

sslocal-js

Make local environment SSL as streamlined as possible.
JavaScript
3
star
41

laughtrack-couch

Couch Logic and Views for LaughTrack
JavaScript
2
star
42

postie

Ruby
2
star
43

spreadsheet-excel

Resurrecting an old gem.
Ruby
2
star
44

babushka-deps

Babushka Dependencies
Ruby
2
star
45

radiant-publican

Automatically copy Radiant extensions' public files on every load for the development environment
2
star
46

.js

JavaScript
1
star
47

shithead

A card game
Ruby
1
star
48

bb8

Keeps Terraform state and variables secret per environment, with help from Voltos
Ruby
1
star
49

lipwig

Write group emails in Markdown, send via Postmark or SMTP.
Ruby
1
star
50

ruby-event-guides

Tips and thoughts about running Rails Camps and RubyConf AU.
1
star
51

thinking-sphinx-examples

Example of advanced search form.
Ruby
1
star
52

trampolinemelb.com

Website for Trampoline, a cross-discipline unconference.
1
star
53

livecal

Translate ical/ics files into actual calendars and events
Ruby
1
star
54

isnotagithubberyet

Because Jan said I should - and who needs a better reason than that?
Ruby
1
star
55

resque-crashlog

Resque failure handler for crashlog.io
Ruby
1
star
56

lu-tze

Automated Backup Helper for Heroku
Ruby
1
star
57

json_template_benchmarking

Ruby
1
star