@pat pat released this Apr 10, 2018 · 4 commits to develop since this release

Assets 2

Major Features and Changes

Thinking Sphinx v4.0 has been in development for a little while, and includes some significant changes (as befitting a major release):

Merging Indices

Merging indices is now supported via the new ts:merge rake task. This is useful when you're using delta indices as an alternative to running ts:index regularly to have new/changed records populated into the core indices. Merging should be reliably faster (and it avoids hitting your database to reprocess all the records).

Running ts:index every now and then to catch any records changed/modified without callbacks is probably wise (perhaps once a day compared to more frequent ts:merge calls).

Run the daemon on a UNIX socket

If you've got Sphinx and your Rails app all on a single machine, you may want to have the daemon (searchd) hosting connections via a UNIX socket instead of a TCP socket. Just set the socket value in each appropriate environment within config/thinking_sphinx.yml (and do not set mysql41 unless you want the daemon to also be available via that TCP port).

production:
  socket: /var/tmp/production.sphinx

This feature is limited to MRI, as JRuby doesn't seem to have a way to connect to UNIX sockets for MySQL-protocol connections.

ActiveRecord 5.2 Support

The new release of ActiveRecord/Rails is happily supported by this release.

Manticore Support

The recent fork of Sphinx known as Manticore is supported, and can be used as a drop-in replacement for Sphinx. In particular, the v2.6.3 release is included in the test matrix.

Breaking Changes

Sphinx 2.1.2 or newer is required

Sphinx 2.0 is no longer supported - make sure you're running at least 2.1.2, but 2.2.11 is recommended if possible.

Ruby 2.2 or newer is required

Versions of Ruby less than 2.2 are no longer supported, sorry.

Removed auto-typing of search filter values

If you're filtering via human-entered values (say, via request parameters), then in the past you were allowed to send those string values straight through to Sphinx.

However, Sphinx now supports string filtering, so it's not possible to make assumptions about filter types. Thinking Sphinx v3.4.0 introduced automatic typing of these values, but this was an extra overhead which was far from ideal and was always flagged as temporary.

So, please cast your filter values where appropriate:

Model.search :with => {:foo_id => params[:foo_id]}
# should become:
Model.search :with => {:foo_id => params[:foo_id].to_i}

Minor features

  • If you want to remove the docinfo setting from the generated Sphinx configuration (to avoid warnings in Sphinx 2.2+), add skip_docinfo: true to each appropriate environment in config/thinking_sphinx.yml.
  • Sphinx 3.0 is now supported.
  • You can now use relative paths in config/thinking_sphinx.yml, but you must also add absolute_paths: true to each environment for them to be converted to absolute paths for the generated configuration.

Changes to behaviour

  • The INDEX_FILTER environment variable is applied when running ts:index on SQL-backed indices.
  • Useful error messages are now displayed if processing real-time indices is attempted when the daemon isn't running.
  • Rake task code has been refactored into separate command classes under the hood (which allows for flying-sphinx to override when appropriate).
  • Added frozen_string_literal: true pragma comments for safe frozen string literals.
  • Exceptions are logged when processing real-time indices without halting the processing.
  • Update polymorphic properties to support Rails 5.2.
  • Allow configuration of the index guard approach (e.g. ThinkingSphinx::Configuration.instance.guarding_strategy = ThinkingSphinx::Guard::None).
  • Output a warning if guard files exist when calling ts:index.
  • Delete index guard files as part of ts:rebuild and ts:clear.

Bug fixes

  • Don't attempt to interpret indices for models that don't have a database table.
  • Handle situations where no exit code is provided for Sphinx binary calls.