@pat pat released this Aug 28, 2017 · 128 commits to develop since this release

Assets 2


There are a few significant changes in this release. There's nothing that's going to break your code, but there are some deprecations (and thus, there will be breaking in later releases), so reading through is highly recommended.

Basic type checking for attribute filters.

Given Riddle now quotes string values in filters (because Sphinx now supports filtering on string attributes), we need to be a little more careful about attribute filter values coming in through params. In the past, Riddle would presume any string value was not actually a string, and that's no longer a safe presumption.

As of this release, Thinking Sphinx will do its best to cast your filter values to their appropriate types, but it's not going to be perfect, and this will be removed in a future release. So, best to do the casting yourself:

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

This is likely going to crop up any time you're using params data in filters, because they'll always be strings.

If you're confident that you're casting all filter values to their appropriate types, you can remove the search middleware that's attempting to auto-cast (and thus, get a bit of a speed boost) by putting the following in an initialiser:


Warnings for unknown options in search calls.

Thinking Sphinx will now output a warning to your logs when unexpected options are used in search queries.

If you’re adding your own middleware in or have something else that may allow for custom options, make sure you add them to ThinkingSphinx::Search.valid_options.

If you don’t want this behaviour to occur, you can remove the middleware from your stack by putting the following in an initialiser:


Unified Rake Tasks

Rake tasks are now unified, so the original tasks will operate on real-time indices as well. What this means is that ts:generate and ts:regenerate can be changed to ts:index and ts:rebuild. All standard tasks will perform their appropriate behaviours on all indices.

If you wish to perform operations on specific types of indices, then there are now tasks available for that, including:

  • ts:sql:index (the old behaviour of ts:index)
  • ts:sql:rebuild (the old behaviour of ts:rebuild)
  • ts:rt:index (the old behaviour of ts:generate)
  • ts:rt:rebuild (the old behaviour of ts:regenerate)

Minor Features

  • Automatically use UTF8 in Sphinx for encodings that are extensions of UTF8 (such as utf8mb4).
  • Allow generation of a single real-time index (Tim Brown) with the INDEX_FILTER environment variable.

Changes to behaviour

  • Handle non-computable queries as parse errors.
  • Don't search multi-table inheritance ancestors.
  • Set a default Sphinx connection timeout of 5 seconds.
  • Use saved_changes if it's available (in Rails 5.1+).
  • Add support for Ruby's frozen string literals feature.
  • Display SphinxQL deletion statements in the log.
  • Allow for unsaved records when calculating document ids (and return nil).
  • Delta callback logic now prioritises checking for high level settings rather than model changes.

Bug Fixes

  • Ensure ts:index now respects rake silent/quiet flags.
  • Use the base class of STI models for polymorphic join generation (via Andrés Cirugeda).
  • Fix multi-field conditions.
  • Fix handling of attached starts of Sphinx (via Henne Vogelsang).
  • Get bigint primary keys working in Rails 5.1.
  • Always close the SphinxQL connection if Innertube's asking (via @cmaion).
  • Fix long SphinxQL query handling in JRuby.
  • Fix Sphinx connections in JRuby.
  • Index normalisation now occurs consistently, and removes unneccesary sphinx_internal_class_name fields from real-time indices.