Thinking Sphinx v3.4.0 Release Notes

Release Date: 2017-08-28 // over 6 years ago
  • ⬆️ Upgrading

    πŸš€ 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:

    ThinkingSphinx::Middlewares::DEFAULT.delete( ThinkingSphinx::Middlewares::AttributeTyper)ThinkingSphinx::Middlewares::RAW\_ONLY.delete( ThinkingSphinx::Middlewares::AttributeTyper)ThinkingSphinx::Middlewares::IDS\_ONLY.delete( ThinkingSphinx::Middlewares::AttributeTyper)
    

    ⚠ 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:

    ThinkingSphinx::Middlewares::DEFAULT.delete( ThinkingSphinx::Middlewares::ValidOptions)ThinkingSphinx::Middlewares::RAW\_ONLY.delete( ThinkingSphinx::Middlewares::ValidOptions)ThinkingSphinx::Middlewares::IDS\_ONLY.delete( ThinkingSphinx::Middlewares::ValidOptions)
    

    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.
    • 0️⃣ 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.