Skip to content

Commit

Permalink
Merge branch 'release/v3.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
pat committed Aug 28, 2017
2 parents 38e634c + ddbcd6b commit 04cc1ea
Show file tree
Hide file tree
Showing 83 changed files with 1,695 additions and 706 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*.gem
.bundle
.rbx
gemfiles
Gemfile.lock
*.sublime-*
pkg/*
Expand Down
49 changes: 29 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
language: ruby
rvm:
- 2.0.0
- 2.1
- 2.2.2
- 2.3.1
- jruby-9.0.5.0
- 2.2.2
- 2.3.4
- 2.4.1
- jruby-9.1.10.0
before_install:
- gem update --system
- gem install bundler
- pip install --upgrade --user awscli
- gem update --system
- gem install bundler
before_script:
- "mysql -e 'create database thinking_sphinx;' > /dev/null"
- "psql -c 'create database thinking_sphinx;' -U postgres >/dev/null"
- bundle exec appraisal install
- mysql -e 'create database thinking_sphinx;' > /dev/null
- psql -c 'create database thinking_sphinx;' -U postgres >/dev/null
- "./bin/loadsphinx $SPHINX_VERSION"
- "./bin/literals"
- bundle exec appraisal install
script: bundle exec appraisal rspec
env:
- DATABASE=mysql2 SPHINX_BIN=/usr/local/sphinx-2.0.10/bin/ SPHINX_VERSION=2.0.10
- DATABASE=postgresql SPHINX_BIN=/usr/local/sphinx-2.0.10/bin/ SPHINX_VERSION=2.0.10
- DATABASE=mysql2 SPHINX_BIN=/usr/local/sphinx-2.1.9/bin/ SPHINX_VERSION=2.1.9
- DATABASE=postgresql SPHINX_BIN=/usr/local/sphinx-2.1.9/bin/ SPHINX_VERSION=2.1.9
- DATABASE=mysql2 SPHINX_BIN=/usr/local/sphinx-2.2.6/bin/ SPHINX_VERSION=2.2.6
- DATABASE=postgresql SPHINX_BIN=/usr/local/sphinx-2.2.6/bin/ SPHINX_VERSION=2.2.6
global:
- SPHINX_BIN=ext/sphinx/bin/
- secure: cUPinkilBafqDSPsTkl/PXYc2aXNKUQKXGK8poBBMqKN9/wjfJx1DWgtowDKalekdZELxDhc85Ye3bL1xlW4nLjOu+U6Tkt8eNw2Nhs1flodHzA/RyENdBLr/tBHt43EjkrDehZx5sBHmWQY4miHs8AJz0oKO9Ae2inTOHx9Iuc=
matrix:
- DATABASE=mysql2 SPHINX_VERSION=2.0.10
- DATABASE=postgresql SPHINX_VERSION=2.0.10
- DATABASE=mysql2 SPHINX_VERSION=2.1.9
- DATABASE=postgresql SPHINX_VERSION=2.1.9
- DATABASE=mysql2 SPHINX_VERSION=2.2.6
- DATABASE=postgresql SPHINX_VERSION=2.2.6
sudo: false
addons:
postgresql: "9.4"
postgresql: '9.4'
services:
- postgresql
- postgresql
matrix:
allow_failures:
- rvm: jruby-9.0.5.0
exclude:
- rvm: jruby-9.1.10.0
env: DATABASE=mysql2 SPHINX_VERSION=2.0.10
- rvm: jruby-9.1.10.0
env: DATABASE=postgresql SPHINX_VERSION=2.0.10
14 changes: 9 additions & 5 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
appraise 'rails_3_2' do
gem 'rails', '~> 3.2.22.2'
gem 'rack', '~> 1.0', :platforms => [:ruby_20, :ruby_21]
end
end if RUBY_VERSION.to_f <= 2.3

appraise 'rails_4_0' do
gem 'rails', '~> 4.0.13'
gem 'rack', '~> 1.0', :platforms => [:ruby_20, :ruby_21]
end
end if RUBY_VERSION.to_f <= 2.3

appraise 'rails_4_1' do
gem 'rails', '~> 4.1.15'
gem 'rack', '~> 1.0', :platforms => [:ruby_20, :ruby_21]
end
end if RUBY_VERSION.to_f <= 2.3

appraise 'rails_4_2' do
gem 'rails', '~> 4.2.6'
gem 'rack', '~> 1.0', :platforms => [:ruby_20, :ruby_21]
end
end if RUBY_VERSION.to_f <= 2.3

appraise 'rails_5_0' do
gem 'rails', '~> 5.0.0'
gem 'rails', '~> 5.0.2'
# gem 'activerecord-jdbc-adapter',
# :git => 'git://github.com/jruby/activerecord-jdbc-adapter.git',
# :branch => 'rails-5',
# :platform => :jruby,
# :ref => 'c3570ce730'
end if RUBY_VERSION.to_f >= 2.2 && RUBY_PLATFORM != 'java'

appraise 'rails_5_1' do
gem 'rails', '~> 5.1.0'
end if RUBY_VERSION.to_f >= 2.2 && RUBY_PLATFORM != 'java'
11 changes: 8 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ gem 'mysql2', '~> 0.3.12b4', :platform => :ruby
gem 'pg', '~> 0.18.4', :platform => :ruby

gem 'jdbc-mysql', '5.1.35', :platform => :jruby
gem 'activerecord-jdbcmysql-adapter', '~> 1.3.4', :platform => :jruby
gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3.4', :platform => :jruby
gem 'activerecord-jdbcmysql-adapter', '~> 1.3.23', :platform => :jruby
gem 'activerecord-jdbcpostgresql-adapter', '~> 1.3.23', :platform => :jruby

gem 'rack', '~> 1.0' if RUBY_VERSION.to_f <= 2.1
if RUBY_VERSION.to_f <= 2.1
gem 'rack', '~> 1.0'
gem 'nokogiri', '1.6.8'
end

gem 'activerecord', '>= 3.2.22' if RUBY_PLATFORM == 'java'
24 changes: 24 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
2017-08-28: 3.4.0
* [CHANGE] Delta callback logic now prioritises checking for high level settings rather than model changes.
* [FIX] Index normalisation now occurs consistently, and removes unneccesary sphinx_internal_class_name fields from real-time indices.
* [FEATURE] Rake tasks are now unified, so the original tasks will operate on real-time indices as well.
* [FEATURE] Output warnings when unknown options are used in search calls.
* [CHANGE] Allow for unsaved records when calculating document ids (and return nil).
* [CHANGE] Display SphinxQL deletion statements in the log.
* [CHANGE] Add support for Ruby's frozen string literals feature.
* [FIX] Fix Sphinx connections in JRuby.
* [FIX] Fix long SphinxQL query handling in JRuby.
* [FEATURE] Allow generation of a single real-time index (Tim Brown).
* [FIX] Always close the SphinxQL connection if Innertube's asking (@cmaion).
* [CHANGE] Use saved_changes if it's available (in Rails 5.1+).
* [FEATURE] Automatically use UTF8 in Sphinx for encodings that are extensions of UTF8.
* [FIX] Get bigint primary keys working in Rails 5.1.
* [CHANGE] Set a default connection timeout of 5 seconds.
* [FIX] Fix handling of attached starts of Sphinx (via Henne Vogelsang).
* [FIX] Fix multi-field conditions.
* [FEATURE] Basic type checking for attribute filters.
* [CHANGE] Don't search multi-table inheritance ancestors.
* [FIX] Use the base class of STI models for polymorphic join generation (via Andrés Cirugeda).
* [CHANGE] Handle non-computable queries as parse errors.
* [FIX] Ensure ts:index now respects rake silent/quiet flags.

2016-12-13: 3.3.0
* [FEATURE] Real-time callbacks can now be used with after_commit hooks if that's preferred over after_save.
* [CHANGE] Only toggle the delta value if the record has changed or is new (rather than on every single save call).
Expand Down
9 changes: 5 additions & 4 deletions README.textile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
h1. Thinking Sphinx

Thinking Sphinx is a library for connecting ActiveRecord to the Sphinx full-text search tool, and integrates closely with Rails (but also works with other Ruby web frameworks). The current release is v3.3.0.
Thinking Sphinx is a library for connecting ActiveRecord to the Sphinx full-text search tool, and integrates closely with Rails (but also works with other Ruby web frameworks). The current release is v3.4.0.

h2. Upgrading

Please refer to the release notes for any changes you need to make when upgrading:

* "v3.4.0":https://github.com/pat/thinking-sphinx/releases/tag/v3.4.0
* "v3.3.0":https://github.com/pat/thinking-sphinx/releases/tag/v3.3.0
* "v3.2.0":https://github.com/pat/thinking-sphinx/releases/tag/v3.2.0
* "v3.1.4":https://github.com/pat/thinking-sphinx/releases/tag/v3.1.4
Expand All @@ -21,9 +22,9 @@ h2. Installation

It's a gem, so install it like you would any other gem. You will also need to specify the mysql2 gem if you're using MRI, or jdbc-mysql if you're using JRuby:

<pre><code>gem 'mysql2', '~> 0.3.18', :platform => :ruby
<pre><code>gem 'mysql2', '~> 0.3', :platform => :ruby
gem 'jdbc-mysql', '= 5.1.35', :platform => :jruby
gem 'thinking-sphinx', '~> 3.3.0'</code></pre>
gem 'thinking-sphinx', '~> 3.4.0'</code></pre>

The MySQL gems mentioned are required for connecting to Sphinx, so please include it even when you're using PostgreSQL for your database. If you're using JRuby, there is "currently an issue with Sphinx and jdbc-mysql 5.1.36 or newer":http://sphinxsearch.com/forum/view.html?id=13939, so you'll need to stick to nothing more recent than 5.1.35.

Expand Down Expand Up @@ -84,4 +85,4 @@ You can then run the unit tests with @rake spec:unit@, the acceptance tests with

h2. Licence

Copyright (c) 2007-2015, Thinking Sphinx is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to "all who have contributed patches":https://github.com/pat/thinking-sphinx/contributors.
Copyright (c) 2007-2017, Thinking Sphinx is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to "all who have contributed patches":https://github.com/pat/thinking-sphinx/contributors.
14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "thinking_sphinx"

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require "irb"
IRB.start(__FILE__)
9 changes: 9 additions & 0 deletions bin/literals
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if (ruby -e "exit RUBY_VERSION.to_f >= 2.4")
then
echo "Automatic frozen string literals are supported"
gem install pragmater -v 4.0.0
pragmater --add lib --comments "# frozen_string_literal: true" --whitelist "**/*.rb"
pragmater --add spec --comments "# frozen_string_literal: true" --whitelist "**/*.rb"
else
echo "Automatic frozen string literals are not supported."
fi
38 changes: 38 additions & 0 deletions bin/loadsphinx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

version=$1
name="sphinx-$version"
url="http://sphinxsearch.com/files/$name-release.tar.gz"
bucket="thinking-sphinx"
directory="ext/sphinx"
prefix="`pwd`/$directory"
file="ext/$name.tar.gz"

download_and_compile_source () {
curl -O $url
tar -zxf $name-release.tar.gz
cd $name-release
./configure --with-mysql --with-pgsql --enable-id64 --prefix=$prefix
make
make install
cd ..
rm -rf $name-release.tar.gz $name-release
}

load_cache () {
aws s3 cp s3://$bucket/bincaches/$name.tar.gz $file
tar -zxf $file
}

push_cache () {
tar -czf $file $directory
aws s3 cp $file s3://$bucket/bincaches/$name.tar.gz --acl public-read
}

if aws s3api head-object --bucket $bucket --key bincaches/$name.tar.gz
then
load_cache
else
download_and_compile_source
push_cache
fi
1 change: 0 additions & 1 deletion gemfiles/.gitignore

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_3_2.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_4_0.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_4_1.gemfile

This file was deleted.

13 changes: 0 additions & 13 deletions gemfiles/rails_4_2.gemfile

This file was deleted.

12 changes: 0 additions & 12 deletions gemfiles/rails_5_0.gemfile

This file was deleted.

17 changes: 15 additions & 2 deletions lib/thinking_sphinx.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
require 'active_support/core_ext/module/attribute_accessors'

module ThinkingSphinx
MAXIMUM_STATEMENT_LENGTH = (2 ** 23) - 1
MAXIMUM_STATEMENT_LENGTH = (2 ** 23) - 5

def self.count(query = '', options = {})
search_for_ids(query, options).total_entries
Expand All @@ -40,14 +40,24 @@ def self.before_index_hooks

@before_index_hooks = []

module Subscribers; end
module Commands; end
module IndexingStrategies; end
module Interfaces; end
module Subscribers; end
end

# Core
require 'thinking_sphinx/attribute_types'
require 'thinking_sphinx/batched_search'
require 'thinking_sphinx/callbacks'
require 'thinking_sphinx/core'
require 'thinking_sphinx/with_output'
require 'thinking_sphinx/commands/base'
require 'thinking_sphinx/commands/configure'
require 'thinking_sphinx/commands/index'
require 'thinking_sphinx/commands/start_attached'
require 'thinking_sphinx/commands/start_detached'
require 'thinking_sphinx/commands/stop'
require 'thinking_sphinx/configuration'
require 'thinking_sphinx/connection'
require 'thinking_sphinx/controller'
Expand All @@ -63,6 +73,9 @@ module IndexingStrategies; end
require 'thinking_sphinx/indexing_strategies/all_at_once'
require 'thinking_sphinx/indexing_strategies/one_at_a_time'
require 'thinking_sphinx/index_set'
require 'thinking_sphinx/interfaces/daemon'
require 'thinking_sphinx/interfaces/real_time'
require 'thinking_sphinx/interfaces/sql'
require 'thinking_sphinx/masks'
require 'thinking_sphinx/middlewares'
require 'thinking_sphinx/panes'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ def after_commit
end

def before_save
return unless new_or_changed? &&
!ThinkingSphinx::Callbacks.suspended? &&
delta_indices?
return unless !ThinkingSphinx::Callbacks.suspended? && delta_indices? &&
new_or_changed?

processors.each { |processor| processor.toggle instance }
end
Expand Down
Loading

0 comments on commit 04cc1ea

Please sign in to comment.