Thinking Sphinx v4.0.0 Release Notes

Release Date: 2018-04-10 // about 6 years ago
  • 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.