thinking-sphinx 4.3.2 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: caea8816a7dcdd55d9889ac7beaef2b2991cf8dd191641eaa698521fb95b6713
4
- data.tar.gz: e0b460d4d58b8edf679bbbc89ee074cba5b8a3c9ba236351cd758444c9106863
3
+ metadata.gz: 51b5ca0d6ec512494befc55c2c96d86e792bbc9e6645522a94cf818f057f0570
4
+ data.tar.gz: 7d7be3bce3f68d23343cc18f1883c88126d51c6e7eb27a3217b65b537b69d2d5
5
5
  SHA512:
6
- metadata.gz: c4a676a4cb6fd8707fcf3cf295862a748dcb74707b152e482593ab59494b6b74afa57c47cf755093de6a115532bead056fb78788ff3cc23047da2ba34f998b62
7
- data.tar.gz: 61bbbbab89a682cf746922938195f3aaa3a626a760c500b098561e59cc41c411181af8b6c464067c5a7376c0120ae3d5c9ccf4aa18f3c035cddfbd4541cb11d3
6
+ metadata.gz: 2a1a2eff2b5f0fd4ee9c8b8fbdc2c137c855e064c9b4759eac336177932499e1d0f184c2bb649b29afb5f3f8d062008464925b90c59bf989b1b49110a73b6c87
7
+ data.tar.gz: 65fd88269268931ea7e9aa4a79a2bb1b919f3ae7c6bfdf7b7bd1569c1465aafd76ef62ddb201ae280c8edae6e5c703dbcac04b18a3437a29ab1e849e485476d0
@@ -1,9 +1,10 @@
1
1
  language: ruby
2
+ dist: xenial
2
3
  rvm:
3
4
  - 2.3.8
4
5
  - 2.4.6
5
6
  - 2.5.5
6
- - 2.6.2
7
+ - 2.6.3
7
8
  before_install:
8
9
  - pip install --upgrade --user awscli
9
10
  - gem update --system
@@ -36,6 +37,9 @@ env:
36
37
  sudo: false
37
38
  addons:
38
39
  postgresql: '9.4'
40
+ apt:
41
+ packages:
42
+ - libodbc1
39
43
  services:
40
44
  - mysql
41
45
  - postgresql
data/Appraisals CHANGED
@@ -44,7 +44,7 @@ appraise 'rails_5_2' do
44
44
  end if RUBY_PLATFORM != 'java'
45
45
 
46
46
  appraise 'rails_6_0' do
47
- gem 'rails', '~> 6.0.0.beta1'
47
+ gem 'rails', '~> 6.0.0'
48
48
  gem 'mysql2', '~> 0.5.0', :platform => :ruby
49
49
  gem 'pg', '~> 1.0', :platform => :ruby
50
50
  end if RUBY_PLATFORM != 'java' && RUBY_VERSION.to_f >= 2.5
@@ -2,6 +2,23 @@
2
2
 
3
3
  All notable changes to this project (at least, from v3.0.0 onwards) are documented in this file.
4
4
 
5
+ ## 4.4.0 - 2019-08-21
6
+
7
+ [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v4.4.0)
8
+
9
+ ### Added
10
+
11
+ * Confirmed Rails 6.0 support.
12
+ * Added ability to have custom real-time index processors (which handles all indices) and populators (which handles a particular index). These are available to get/set via `ThinkingSphinx::RealTime.processor` and `ThinkingSphinx::RealTime.populator` (and discussed in more detail in the [release notes](https://github.com/pat/thinking-sphinx/releases/tag/v4.4.0)).
13
+
14
+ ### Changed
15
+
16
+ * Improve failure message when tables don't exist for models associated with Sphinx indices ([Kiril Mitov](https://github.com/thebravoman) in [#1139](https://github.com/pat/thinking-sphinx/pull/1139)).
17
+
18
+ ### Fixed
19
+
20
+ * Injected has-many/habtm collection search calls as default extensions to associations in Rails 5+, as it's a more reliable approach in Rails 6.0.0.
21
+
5
22
  ## 4.3.2 - 2019-07-10
6
23
 
7
24
  [Release Notes](https://github.com/pat/thinking-sphinx/releases/tag/v4.3.2)
@@ -1,6 +1,6 @@
1
1
  h1. Thinking Sphinx
2
2
 
3
- 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 v4.3.2.
3
+ 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 v4.4.0.
4
4
 
5
5
  h2. Upgrading
6
6
 
@@ -3,13 +3,18 @@
3
3
  version=$1
4
4
  engine=$2
5
5
 
6
+ set -e
7
+
6
8
  load_sphinx () {
9
+ distro="xenial"
10
+
7
11
  case $version in
8
12
  2.1.9)
9
13
  url="http://sphinxsearch.com/files/sphinxsearch_2.1.9-release-0ubuntu11~trusty_amd64.deb"
10
- format="deb";;
14
+ format="deb"
15
+ distro="trusty";;
11
16
  2.2.11)
12
- url="http://sphinxsearch.com/files/sphinxsearch_2.2.11-release-1~trusty_amd64.deb"
17
+ url="http://sphinxsearch.com/files/sphinxsearch_2.2.11-release-1~xenial_amd64.deb"
13
18
  format="deb";;
14
19
  3.0.3)
15
20
  url="http://sphinxsearch.com/files/sphinx-3.0.3-facc3fb-linux-amd64.tar.gz"
@@ -22,6 +27,11 @@ load_sphinx () {
22
27
  exit 1;;
23
28
  esac
24
29
 
30
+ if [ "$distro" == "trusty" ]; then
31
+ curl --location http://launchpadlibrarian.net/247512886/libmysqlclient18_5.6.28-1ubuntu3_amd64.deb -o libmysql.deb
32
+ sudo apt-get install ./libmysql.deb
33
+ fi
34
+
25
35
  if [ "$format" == "deb" ]; then
26
36
  curl --location $url -o sphinx.deb
27
37
  sudo apt-get install ./sphinx.deb
@@ -37,11 +47,11 @@ load_manticore () {
37
47
 
38
48
  case $version in
39
49
  2.6.4)
40
- url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.6.4/manticore_2.6.4-180503-37308c3-release-stemmer.trusty_amd64-bin.deb";;
50
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.6.4/manticore_2.6.4-180503-37308c3-release-stemmer.xenial_amd64-bin.deb";;
41
51
  2.7.5)
42
- url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.7.5/manticore_2.7.5-181204-0f016406-release-stemmer.trusty_amd64-bin.deb";;
52
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.7.5/manticore_2.7.5-181204-4a31c54-release-stemmer.xenial_amd64-bin.deb";;
43
53
  2.8.2)
44
- url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.8.2/manticore_2.8.2-190402-4e81114-release-stemmer.trusty_amd64-bin.deb";;
54
+ url="https://github.com/manticoresoftware/manticoresearch/releases/download/2.8.2/manticore_2.8.2-190402-4e81114-release-stemmer.xenial_amd64-bin.deb";;
45
55
  *)
46
56
  echo "No Manticore version $version available"
47
57
  exit 1;;
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ThinkingSphinx::ActiveRecord::AssociationProxy
4
- extend ActiveSupport::Concern
5
-
6
4
  def search(query = nil, options = {})
7
5
  perform_search super(*normalise_search_arguments(query, options))
8
6
  end
@@ -12,6 +10,7 @@ module ThinkingSphinx::ActiveRecord::AssociationProxy
12
10
  end
13
11
 
14
12
  private
13
+
15
14
  def normalise_search_arguments(query, options)
16
15
  query, options = nil, query if query.is_a?(Hash)
17
16
  options[:ignore_scopes] = true
@@ -9,8 +9,23 @@ module ThinkingSphinx::ActiveRecord::Base
9
9
  after_update ThinkingSphinx::ActiveRecord::Callbacks::UpdateCallbacks
10
10
  after_commit ThinkingSphinx::ActiveRecord::Callbacks::DeltaCallbacks
11
11
 
12
- ::ActiveRecord::Associations::CollectionProxy.send :include,
13
- ThinkingSphinx::ActiveRecord::AssociationProxy
12
+ if ActiveRecord::VERSION::STRING.to_i >= 5
13
+ [
14
+ ::ActiveRecord::Reflection::HasManyReflection,
15
+ ::ActiveRecord::Reflection::HasAndBelongsToManyReflection
16
+ ].each do |reflection_class|
17
+ reflection_class.include DefaultReflectionAssociations
18
+ end
19
+ else
20
+ ::ActiveRecord::Associations::CollectionProxy.send :include,
21
+ ThinkingSphinx::ActiveRecord::AssociationProxy
22
+ end
23
+ end
24
+
25
+ module DefaultReflectionAssociations
26
+ def extensions
27
+ super + [ThinkingSphinx::ActiveRecord::AssociationProxy]
28
+ end
14
29
  end
15
30
 
16
31
  module ClassMethods
@@ -2,9 +2,7 @@
2
2
 
3
3
  class ThinkingSphinx::Commands::IndexRealTime < ThinkingSphinx::Commands::Base
4
4
  def call
5
- options[:indices].each do |index|
6
- ThinkingSphinx::RealTime::Populator.populate index
7
-
5
+ ThinkingSphinx::RealTime.processor.call options[:indices] do
8
6
  command :rotate
9
7
  end
10
8
  end
@@ -38,7 +38,11 @@ module ThinkingSphinx::Core::Index
38
38
  end
39
39
 
40
40
  def interpret_definition!
41
- return unless model.table_exists?
41
+ table_exists = model.table_exists?
42
+ unless table_exists
43
+ Rails.logger.info "No table exists for #{model}. Index can not be created"
44
+ return
45
+ end
42
46
  return if @interpreted_definition
43
47
 
44
48
  apply_defaults!
@@ -8,6 +8,22 @@ module ThinkingSphinx::RealTime
8
8
  def self.callback_for(reference, path = [], &block)
9
9
  Callbacks::RealTimeCallbacks.new reference.to_sym, path, &block
10
10
  end
11
+
12
+ def self.populator
13
+ @populator ||= ThinkingSphinx::RealTime::Populator
14
+ end
15
+
16
+ def self.populator=(value)
17
+ @populator = value
18
+ end
19
+
20
+ def self.processor
21
+ @processor ||= ThinkingSphinx::RealTime::Processor
22
+ end
23
+
24
+ def self.processor=(value)
25
+ @processor = value
26
+ end
11
27
  end
12
28
 
13
29
  require 'thinking_sphinx/real_time/property'
@@ -16,6 +32,7 @@ require 'thinking_sphinx/real_time/field'
16
32
  require 'thinking_sphinx/real_time/index'
17
33
  require 'thinking_sphinx/real_time/interpreter'
18
34
  require 'thinking_sphinx/real_time/populator'
35
+ require 'thinking_sphinx/real_time/processor'
19
36
  require 'thinking_sphinx/real_time/transcribe_instance'
20
37
  require 'thinking_sphinx/real_time/transcriber'
21
38
  require 'thinking_sphinx/real_time/translator'
@@ -9,7 +9,7 @@ class ThinkingSphinx::RealTime::Populator
9
9
  @index = index
10
10
  end
11
11
 
12
- def populate(&block)
12
+ def populate
13
13
  instrument 'start_populating'
14
14
 
15
15
  scope.find_in_batches(:batch_size => batch_size) do |instances|
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ThinkingSphinx::RealTime::Processor
4
+ def self.call(indices, &block)
5
+ new(indices).call(&block)
6
+ end
7
+
8
+ def initialize(indices)
9
+ @indices = indices
10
+ end
11
+
12
+ def call(&block)
13
+ subscribe_to_progress
14
+
15
+ indices.each do |index|
16
+ ThinkingSphinx::RealTime.populator.populate index
17
+
18
+ block.call
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ attr_reader :indices
25
+
26
+ def command
27
+ ThinkingSphinx::Commander.call(
28
+ command, configuration, options, stream
29
+ )
30
+ end
31
+
32
+ def subscribe_to_progress
33
+ ThinkingSphinx::Subscribers::PopulatorSubscriber.
34
+ attach_to 'thinking_sphinx.real_time'
35
+ end
36
+ end
@@ -46,7 +46,3 @@ Error transcribing #{instance.class} #{instance.id}:
46
46
  delegate :output, :to => ThinkingSphinx
47
47
  delegate :puts, :print, :to => :output
48
48
  end
49
-
50
- ThinkingSphinx::Subscribers::PopulatorSubscriber.attach_to(
51
- 'thinking_sphinx.real_time'
52
- )
@@ -5,7 +5,7 @@ $:.push File.expand_path('../lib', __FILE__)
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'thinking-sphinx'
8
- s.version = '4.3.2'
8
+ s.version = '4.4.0'
9
9
  s.platform = Gem::Platform::RUBY
10
10
  s.authors = ["Pat Allan"]
11
11
  s.email = ["pat@freelancing-gods.com"]
@@ -14,8 +14,6 @@ Gem::Specification.new do |s|
14
14
  s.description = %Q{An intelligent layer for ActiveRecord (via Rails and Sinatra) for the Sphinx full-text search tool.}
15
15
  s.license = 'MIT'
16
16
 
17
- s.rubyforge_project = 'thinking-sphinx'
18
-
19
17
  s.files = `git ls-files`.split("\n")
20
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thinking-sphinx
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.2
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Allan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-10 00:00:00.000000000 Z
11
+ date: 2019-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -329,6 +329,7 @@ files:
329
329
  - lib/thinking_sphinx/real_time/index/template.rb
330
330
  - lib/thinking_sphinx/real_time/interpreter.rb
331
331
  - lib/thinking_sphinx/real_time/populator.rb
332
+ - lib/thinking_sphinx/real_time/processor.rb
332
333
  - lib/thinking_sphinx/real_time/property.rb
333
334
  - lib/thinking_sphinx/real_time/transcribe_instance.rb
334
335
  - lib/thinking_sphinx/real_time/transcriber.rb
@@ -521,7 +522,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
521
522
  - !ruby/object:Gem::Version
522
523
  version: '0'
523
524
  requirements: []
524
- rubygems_version: 3.0.3
525
+ rubygems_version: 3.0.4
525
526
  signing_key:
526
527
  specification_version: 4
527
528
  summary: A smart wrapper over Sphinx for ActiveRecord