Skip to content

v3.1.3

Compare
Choose a tag to compare
@pat pat released this 21 Jan 08:47
· 562 commits to develop since this release

Upgrading

There's no modification required if you're upgrading from v3.1.2, though running rake ts:regenerate is recommended if you're using real-time indices. Of course, if you're using something older than v3.1.2, reading the earlier release notes is highly recommended.

This is the first release to properly support Rails 4.2.

New Features

Two new features, both related to using Thinking Sphinx with multiple data sources (in particular, different PostgreSQL schemas via the Apartment gem):

Allow for custom IndexSet classes

If you want to change which indices are returned in different situations, you can set a custom class:

ThinkingSphinx::Configuration.instance.index_set_class = TenantIndexSet

Allow for custom offset references

Because Sphinx requires all document ids to be unique - even across different indices - they're generated via a unique offset combined with model primary keys. Normally, Thinking Sphinx will use the same offset calculation if you have more than one index for a given model - as they're likely the same record.

However, if you're using the Apartment gem, then this is probably not the case - you have identical tables in different schemas, with different sets of overlapping primary keys. So, there's a need for indices for each Apartment tenant on one model to be considered as separate. The :offset_option when defining an index will sort this out.

Here is a gist covering both of these new features.

Changes to behaviour

  • Add bigint support for real-time indices, and use bigints for the sphinx_internal_id attribute (mapped to model primary keys) (Chance Downs).
  • Convert raw Sphinx results to an array when querying (Bryan Ricker).
  • Load Railtie if Rails::Railtie is defined, instead of just Rails (Andrew Cone).
  • Log excerpt SphinxQL queries just like the search queries.

Bug Fixes

  • Don't double-up on STI filtering, already handled by Rails.
  • Don't load ActiveRecord early - fixes a warning in Rails 4.2.
  • Use reflect_on_association instead of reflections, to stick to the public ActiveRecord::Base API.
  • Generate de-polymorphised associations properly for Rails 4.2