Skip to content

v3.1.1

Compare
Choose a tag to compare
@pat pat released this 21 Apr 14:42
· 627 commits to develop since this release

Upgrading

There's no modification required if you're upgrading from v3.1.0. Of course, if you're using something older than that, reading the earlier release notes is highly recommended.

New Features

Sphinx v2.2

This release has the beginnings of support for Sphinx v2.2, including the common options section. This is disabled by default (as it won't work with earlier versions of Sphinx), but if you're keen to give it a spin, add the following to each environment in config/thinking_sphinx.yml:

common_sphinx_configuration: true

At some point, this will become the default behaviour (likely Thinking Sphinx v3.2.0), but we're a while away from that.

Disabling distributed indices

If you want to disable the automatically generated distributed indices, set distributed_indices: false in each environment in config/thinking_sphinx.yml.

Testing with real-time indices

ThinkingSphinx::Test is now in a position for proper use with real-time indices. Here's how I use it with RSpec (with the relevant examples tagged with :search => true):

RSpec.configure do |config|
  config.before(:each) do
    if example.metadata[:search]
      ThinkingSphinx::Test.init
      ThinkingSphinx::Test.start :index => false
    end

    ThinkingSphinx::Configuration.instance.settings['real_time_callbacks'] = !!example.metadata[:search]
  end

  config.after(:each) do
    if example.metadata[:search]
      ThinkingSphinx::Test.stop
      ThinkingSphinx::Test.clear
    end
  end
end

The setting for disabling real-time callbacks can be used anywhere, of course - but keep in mind this could lead to your model data being out of sync with Sphinx.

HABTM MVAs with query/ranged-query sources

Previously this wasn't supported at all - now, it's only partially supported, for the foreign keys of single HABTM associations (you can't drill further through associations):

has genres.id, :as => :genre_ids, :source => :query

The association/column reference above is slightly misleading - it will actually use the genre_id column in the HABTM join table (thus, avoiding unnecessary joins). You still cannot use the :source option with columns in other tables accessed through HABTM associations.

Changes to behaviour

  • All indices now respond to a public attributes method.
  • Log real-time index updates (Demian Ferreiro).
  • Alias group and count columns for easier referencing in other clauses.
  • Capistrano tasks use thinking_sphinx_rails_env (defaults to standard environment) (Robert Coleman).
  • Raise an exception when a referenced column does not exist.
  • Connection error messages now mention Sphinx, instead of just MySQL.
  • Include full statements when query execution errors are raised (uglier, but more useful when debugging).

Bug Fixes

  • Improved handling of association searches with real-time indices, including via has_many :though associations (Rob Anderton).
  • Fixing wildcarding of Unicode strings.
  • Handle JDBC connection errors appropriately (Adam Hutchison).
  • Only expand log directory if it exists.
  • :thinking_sphinx_roles is now used consistently in Capistrano v3 tasks.
  • :populate option is now respected for single-model searches.
  • Don't send unicode null characters to real-time Sphinx indices.
  • Avoid null values in MVA query/ranged-query sources.
  • respond_to? works reliably with masks (Konstantin Burnaev).
  • Always use connection options for connection information.
  • Don't presume all indices for a model have delta pairs, even if one does.
  • Don't instantiate blank strings (via inheritance type columns) as constants.
  • Don't apply attribute-only updates to real-time indices.