thinking-sphinx 5.5.1 → 5.6.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 +4 -4
- data/.github/workflows/ci.yml +6 -7
- data/Appraisals +6 -0
- data/CHANGELOG.markdown +19 -0
- data/README.textile +4 -4
- data/bin/loadsphinx +15 -4
- data/lib/thinking_sphinx/active_record/base.rb +23 -4
- data/lib/thinking_sphinx/active_record/filter_reflection.rb +1 -1
- data/lib/thinking_sphinx/active_record/log_subscriber.rb +16 -4
- data/lib/thinking_sphinx/commands/clear_real_time.rb +1 -1
- data/lib/thinking_sphinx/commands/clear_sql.rb +1 -1
- data/lib/thinking_sphinx/configuration/minimum_fields.rb +8 -8
- data/lib/thinking_sphinx/masks/scopes_mask.rb +6 -0
- data/lib/thinking_sphinx/processor.rb +34 -8
- data/lib/thinking_sphinx/search/context.rb +1 -0
- data/lib/thinking_sphinx/search.rb +2 -2
- data/lib/thinking_sphinx/test.rb +1 -1
- data/lib/thinking_sphinx.rb +4 -0
- data/spec/acceptance/attribute_access_spec.rb +4 -4
- data/spec/acceptance/excerpts_spec.rb +2 -2
- data/spec/acceptance/grouping_by_attributes_spec.rb +20 -20
- data/spec/acceptance/real_time_updates_spec.rb +61 -1
- data/spec/acceptance/searching_across_models_spec.rb +7 -0
- data/spec/acceptance/searching_with_filters_spec.rb +8 -8
- data/spec/acceptance/searching_within_a_model_spec.rb +14 -0
- data/spec/acceptance/sorting_search_results_spec.rb +15 -15
- data/spec/acceptance/sphinx_scopes_spec.rb +23 -16
- data/spec/internal/app/indices/article_index.rb +6 -0
- data/spec/internal/app/indices/book_index.rb +1 -1
- data/spec/internal/app/models/book.rb +5 -5
- data/spec/internal/db/schema.rb +1 -1
- data/spec/thinking_sphinx/active_record/callbacks/update_callbacks_spec.rb +1 -1
- data/spec/thinking_sphinx/active_record/interpreter_spec.rb +5 -5
- data/spec/thinking_sphinx/commands/clear_real_time_spec.rb +2 -2
- data/spec/thinking_sphinx/commands/clear_sql_spec.rb +2 -2
- data/spec/thinking_sphinx/configuration/minimum_fields_spec.rb +12 -2
- data/spec/thinking_sphinx/excerpter_spec.rb +3 -2
- data/spec/thinking_sphinx/index_spec.rb +2 -2
- data/spec/thinking_sphinx/middlewares/sphinxql_spec.rb +4 -4
- data/spec/thinking_sphinx/panes/excerpts_pane_spec.rb +1 -1
- data/spec/thinking_sphinx/real_time/interpreter_spec.rb +5 -5
- data/spec/thinking_sphinx_spec.rb +2 -2
- data/thinking-sphinx.gemspec +3 -3
- metadata +6 -6
@@ -37,4 +37,11 @@ describe 'Searching across models', :live => true do
|
|
37
37
|
expect(ThinkingSphinx.search(:classes => [User, Article]).to_a).
|
38
38
|
to match_array([article, user])
|
39
39
|
end
|
40
|
+
|
41
|
+
it "has a 'none' default scope" do
|
42
|
+
article = Article.create! :title => 'Pancakes'
|
43
|
+
index
|
44
|
+
|
45
|
+
expect(ThinkingSphinx.none).to be_empty
|
46
|
+
end
|
40
47
|
end
|
@@ -12,12 +12,12 @@ describe 'Searching with filters', :live => true do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it "limits results by an array of values" do
|
15
|
-
gods = Book.create! :title => 'American Gods', :
|
16
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
17
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
15
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
16
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
17
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
18
18
|
index
|
19
19
|
|
20
|
-
expect(Book.search(:with => {:
|
20
|
+
expect(Book.search(:with => {:publishing_year => [2001, 2005]}).to_a).to match_array([gods, boys])
|
21
21
|
end
|
22
22
|
|
23
23
|
it "limits results by a ranged filter" do
|
@@ -43,12 +43,12 @@ describe 'Searching with filters', :live => true do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "limits results by exclusive filters on arrays of values" do
|
46
|
-
gods = Book.create! :title => 'American Gods', :
|
47
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
48
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
46
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
47
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
48
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
49
49
|
index
|
50
50
|
|
51
|
-
expect(Book.search(:without => {:
|
51
|
+
expect(Book.search(:without => {:publishing_year => [2001, 2005]}).to_a).to eq([grave])
|
52
52
|
end
|
53
53
|
|
54
54
|
it "limits results by ranged filters on timestamp MVAs" do
|
@@ -92,6 +92,20 @@ describe 'Searching within a model', :live => true do
|
|
92
92
|
expect(Album.search(:indices => ['album_real_core']).first).
|
93
93
|
to eq(album)
|
94
94
|
end
|
95
|
+
|
96
|
+
it "is available via a sphinx-prefixed method" do
|
97
|
+
article = Article.create! :title => 'Pancakes'
|
98
|
+
index
|
99
|
+
|
100
|
+
expect(Article.sphinx_search.first).to eq(article)
|
101
|
+
end
|
102
|
+
|
103
|
+
it "has a 'none' default scope" do
|
104
|
+
article = Article.create! :title => 'Pancakes'
|
105
|
+
index
|
106
|
+
|
107
|
+
expect(Article.search_none).to be_empty
|
108
|
+
end
|
95
109
|
end
|
96
110
|
|
97
111
|
describe 'Searching within a model with a realtime index', :live => true do
|
@@ -4,27 +4,27 @@ require 'acceptance/spec_helper'
|
|
4
4
|
|
5
5
|
describe 'Sorting search results', :live => true do
|
6
6
|
it "sorts by a given clause" do
|
7
|
-
gods = Book.create! :title => 'American Gods', :
|
8
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
9
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
7
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
8
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
9
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
10
10
|
index
|
11
11
|
|
12
|
-
expect(Book.search(:order => '
|
12
|
+
expect(Book.search(:order => 'publishing_year ASC').to_a).to eq([gods, boys, grave])
|
13
13
|
end
|
14
14
|
|
15
15
|
it "sorts by a given attribute in ascending order" do
|
16
|
-
gods = Book.create! :title => 'American Gods', :
|
17
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
18
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
16
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
17
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
18
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
19
19
|
index
|
20
20
|
|
21
|
-
expect(Book.search(:order => :
|
21
|
+
expect(Book.search(:order => :publishing_year).to_a).to eq([gods, boys, grave])
|
22
22
|
end
|
23
23
|
|
24
24
|
it "sorts by a given sortable field" do
|
25
|
-
gods = Book.create! :title => 'American Gods', :
|
26
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
27
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
25
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
26
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
27
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
28
28
|
index
|
29
29
|
|
30
30
|
expect(Book.search(:order => :title).to_a).to eq([gods, boys, grave])
|
@@ -38,13 +38,13 @@ describe 'Sorting search results', :live => true do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
it "can sort with a provided expression" do
|
41
|
-
gods = Book.create! :title => 'American Gods', :
|
42
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
43
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
41
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
42
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
43
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
44
44
|
index
|
45
45
|
|
46
46
|
expect(Book.search(
|
47
|
-
:select => '*,
|
47
|
+
:select => '*, publishing_year MOD 2004 as mod_year', :order => 'mod_year ASC'
|
48
48
|
).to_a).to eq([boys, grave, gods])
|
49
49
|
end
|
50
50
|
end
|
@@ -4,39 +4,39 @@ require 'acceptance/spec_helper'
|
|
4
4
|
|
5
5
|
describe 'Sphinx scopes', :live => true do
|
6
6
|
it "allows calling sphinx scopes from models" do
|
7
|
-
gods = Book.create! :title => 'American Gods', :
|
8
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
9
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
7
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
8
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
9
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
10
10
|
index
|
11
11
|
|
12
|
-
expect(Book.
|
12
|
+
expect(Book.by_publishing_year(2009).to_a).to eq([grave])
|
13
13
|
end
|
14
14
|
|
15
15
|
it "allows scopes to return both query and options" do
|
16
|
-
gods = Book.create! :title => 'American Gods', :
|
17
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
18
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
16
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
17
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
18
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
19
19
|
index
|
20
20
|
|
21
|
-
expect(Book.
|
21
|
+
expect(Book.by_query_and_publishing_year('Graveyard', 2009).to_a).to eq([grave])
|
22
22
|
end
|
23
23
|
|
24
24
|
it "allows chaining of scopes" do
|
25
|
-
gods = Book.create! :title => 'American Gods', :
|
26
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
27
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
25
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
26
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
27
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
28
28
|
index
|
29
29
|
|
30
|
-
expect(Book.
|
30
|
+
expect(Book.by_publishing_year(2001..2005).ordered.to_a).to eq([boys, gods])
|
31
31
|
end
|
32
32
|
|
33
33
|
it "allows chaining of scopes that include queries" do
|
34
|
-
gods = Book.create! :title => 'American Gods', :
|
35
|
-
boys = Book.create! :title => 'Anansi Boys', :
|
36
|
-
grave = Book.create! :title => 'The Graveyard Book', :
|
34
|
+
gods = Book.create! :title => 'American Gods', :publishing_year => 2001
|
35
|
+
boys = Book.create! :title => 'Anansi Boys', :publishing_year => 2005
|
36
|
+
grave = Book.create! :title => 'The Graveyard Book', :publishing_year => 2009
|
37
37
|
index
|
38
38
|
|
39
|
-
expect(Book.
|
39
|
+
expect(Book.by_publishing_year(2001).by_query_and_publishing_year('Graveyard', 2009).to_a).
|
40
40
|
to eq([grave])
|
41
41
|
end
|
42
42
|
|
@@ -77,4 +77,11 @@ describe 'Sphinx scopes', :live => true do
|
|
77
77
|
ThinkingSphinx::PopulatedResultsError
|
78
78
|
)
|
79
79
|
end
|
80
|
+
|
81
|
+
it "handles a chainable 'none' scope and returns nothing" do
|
82
|
+
Book.create! :title => 'Small Gods'
|
83
|
+
index
|
84
|
+
|
85
|
+
expect(Book.by_query('gods').none).to be_empty
|
86
|
+
end
|
80
87
|
end
|
@@ -23,3 +23,9 @@ ThinkingSphinx::Index.define :article, :with => :active_record,
|
|
23
23
|
|
24
24
|
set_property :morphology => 'stem_en'
|
25
25
|
end
|
26
|
+
|
27
|
+
ThinkingSphinx::Index.define :article, :name => :published_articles, :with => :real_time do
|
28
|
+
indexes title, content
|
29
|
+
|
30
|
+
scope { Article.where :published => true }
|
31
|
+
end
|
@@ -8,11 +8,11 @@ class Book < ActiveRecord::Base
|
|
8
8
|
ThinkingSphinx::Callbacks.append(self, :behaviours => [:sql, :deltas])
|
9
9
|
|
10
10
|
sphinx_scope(:by_query) { |query| query }
|
11
|
-
sphinx_scope(:
|
12
|
-
{:with => {:
|
11
|
+
sphinx_scope(:by_publishing_year) do |year|
|
12
|
+
{:with => {:publishing_year => year}}
|
13
13
|
end
|
14
|
-
sphinx_scope(:
|
15
|
-
[query, {:with => {:
|
14
|
+
sphinx_scope(:by_query_and_publishing_year) do |query, year|
|
15
|
+
[query, {:with => {:publishing_year =>year}}]
|
16
16
|
end
|
17
|
-
sphinx_scope(:ordered) { {:order => '
|
17
|
+
sphinx_scope(:ordered) { {:order => 'publishing_year DESC'} }
|
18
18
|
end
|
data/spec/internal/db/schema.rb
CHANGED
@@ -39,7 +39,7 @@ ActiveRecord::Schema.define do
|
|
39
39
|
create_table(:books, :force => true) do |t|
|
40
40
|
t.string :title
|
41
41
|
t.string :author
|
42
|
-
t.integer :
|
42
|
+
t.integer :publishing_year
|
43
43
|
t.string :blurb_file
|
44
44
|
t.boolean :delta, :default => true, :null => false
|
45
45
|
t.string :type, :default => 'Book', :null => false
|
@@ -60,7 +60,7 @@ describe ThinkingSphinx::ActiveRecord::Callbacks::UpdateCallbacks do
|
|
60
60
|
|
61
61
|
it "builds an update query with only updateable attributes that have changed" do
|
62
62
|
expect(Riddle::Query).to receive(:update).
|
63
|
-
with('article_core', 3, 'bar' => 7).and_return('SphinxQL')
|
63
|
+
with('article_core', 3, { 'bar' => 7 }).and_return('SphinxQL')
|
64
64
|
|
65
65
|
callbacks.after_update
|
66
66
|
end
|
@@ -93,7 +93,7 @@ describe ThinkingSphinx::ActiveRecord::Interpreter do
|
|
93
93
|
|
94
94
|
it "passes through options to the attribute" do
|
95
95
|
expect(ThinkingSphinx::ActiveRecord::Attribute).to receive(:new).
|
96
|
-
with(model, column, :as => :other_name).and_return(attribute)
|
96
|
+
with(model, column, { :as => :other_name }).and_return(attribute)
|
97
97
|
|
98
98
|
instance.has column, :as => :other_name
|
99
99
|
end
|
@@ -141,7 +141,7 @@ describe ThinkingSphinx::ActiveRecord::Interpreter do
|
|
141
141
|
|
142
142
|
it "passes through options to the field" do
|
143
143
|
expect(ThinkingSphinx::ActiveRecord::Field).to receive(:new).
|
144
|
-
with(model, column, :as => :other_name).and_return(field)
|
144
|
+
with(model, column, { :as => :other_name }).and_return(field)
|
145
145
|
|
146
146
|
instance.indexes column, :as => :other_name
|
147
147
|
end
|
@@ -230,19 +230,19 @@ describe ThinkingSphinx::ActiveRecord::Interpreter do
|
|
230
230
|
end
|
231
231
|
|
232
232
|
it "sends through a hash if provided" do
|
233
|
-
expect(source).to receive(:set_database_settings).with(:foo => :bar)
|
233
|
+
expect(source).to receive(:set_database_settings).with({ :foo => :bar })
|
234
234
|
|
235
235
|
instance.set_database :foo => :bar
|
236
236
|
end
|
237
237
|
|
238
238
|
it "finds the environment settings if given a string key" do
|
239
|
-
expect(source).to receive(:set_database_settings).with(:baz => 'qux')
|
239
|
+
expect(source).to receive(:set_database_settings).with({ :baz => 'qux' })
|
240
240
|
|
241
241
|
instance.set_database 'other'
|
242
242
|
end
|
243
243
|
|
244
244
|
it "finds the environment settings if given a symbol key" do
|
245
|
-
expect(source).to receive(:set_database_settings).with(:baz => 'qux')
|
245
|
+
expect(source).to receive(:set_database_settings).with({ :baz => 'qux' })
|
246
246
|
|
247
247
|
instance.set_database :other
|
248
248
|
end
|
@@ -17,7 +17,7 @@ RSpec.describe ThinkingSphinx::Commands::ClearRealTime do
|
|
17
17
|
allow(Dir).to receive(:[]).with('/path/to/my/index/parts.*').
|
18
18
|
and_return(['parts.a', 'parts.b'])
|
19
19
|
|
20
|
-
allow(FileUtils).to receive_messages :
|
20
|
+
allow(FileUtils).to receive_messages :rm_rf => true,
|
21
21
|
:rm => true
|
22
22
|
allow(File).to receive_messages :exist? => true
|
23
23
|
end
|
@@ -30,7 +30,7 @@ RSpec.describe ThinkingSphinx::Commands::ClearRealTime do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "removes the directory for the binlog files" do
|
33
|
-
expect(FileUtils).to receive(:
|
33
|
+
expect(FileUtils).to receive(:rm_rf).with('/path/to/binlog')
|
34
34
|
|
35
35
|
command.call
|
36
36
|
end
|
@@ -24,7 +24,7 @@ RSpec.describe ThinkingSphinx::Commands::ClearSQL do
|
|
24
24
|
allow(Dir).to receive(:[]).with('/path/to/indices/ts-*.tmp').
|
25
25
|
and_return(['/path/to/indices/ts-foo.tmp'])
|
26
26
|
|
27
|
-
allow(FileUtils).to receive_messages :
|
27
|
+
allow(FileUtils).to receive_messages :rm_rf => true, :rm => true
|
28
28
|
allow(File).to receive_messages :exist? => true
|
29
29
|
end
|
30
30
|
|
@@ -45,7 +45,7 @@ RSpec.describe ThinkingSphinx::Commands::ClearSQL do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "removes any indexing guard files" do
|
48
|
-
expect(FileUtils).to receive(:
|
48
|
+
expect(FileUtils).to receive(:rm_rf).with(["/path/to/indices/ts-foo.tmp"])
|
49
49
|
|
50
50
|
command.call
|
51
51
|
end
|
@@ -6,7 +6,7 @@ RSpec.describe ThinkingSphinx::Configuration::MinimumFields do
|
|
6
6
|
let(:indices) { [index_a, index_b] }
|
7
7
|
let(:index_a) { double 'Index A', :model => model_a, :type => 'plain',
|
8
8
|
:sources => [double(:fields => [field_a1, field_a2])] }
|
9
|
-
let(:index_b) { double 'Index B', :model =>
|
9
|
+
let(:index_b) { double 'Index B', :model => model_b, :type => 'rt',
|
10
10
|
:fields => [field_b1, field_b2] }
|
11
11
|
let(:field_a1) { double :name => 'sphinx_internal_class_name' }
|
12
12
|
let(:field_a2) { double :name => 'name' }
|
@@ -38,7 +38,7 @@ RSpec.describe ThinkingSphinx::Configuration::MinimumFields do
|
|
38
38
|
expect(index_b.fields).to eq([field_b2])
|
39
39
|
end
|
40
40
|
|
41
|
-
it 'removes the class name fields only for the indices without type column' do
|
41
|
+
it 'removes the class name fields only for the rt indices without type column' do
|
42
42
|
allow(model_a).to receive(:column_names).and_return(['id', 'name', 'type'])
|
43
43
|
allow(model_b).to receive(:column_names).and_return(['id', 'name'])
|
44
44
|
|
@@ -47,4 +47,14 @@ RSpec.describe ThinkingSphinx::Configuration::MinimumFields do
|
|
47
47
|
expect(index_a.sources.first.fields).to eq([field_a1, field_a2])
|
48
48
|
expect(index_b.fields).to eq([field_b2])
|
49
49
|
end
|
50
|
+
|
51
|
+
it 'removes the class name fields only for the plain indices without type column' do
|
52
|
+
allow(model_a).to receive(:column_names).and_return(['id', 'name'])
|
53
|
+
allow(model_b).to receive(:column_names).and_return(['id', 'name', 'type'])
|
54
|
+
|
55
|
+
subject.reconcile
|
56
|
+
|
57
|
+
expect(index_a.sources.first.fields).to eq([field_a2])
|
58
|
+
expect(index_b.fields).to eq([field_b1, field_b2])
|
59
|
+
end
|
50
60
|
end
|
@@ -28,9 +28,10 @@ describe ThinkingSphinx::Excerpter do
|
|
28
28
|
:before_match => '<b>', :chunk_separator => ' -- ')
|
29
29
|
|
30
30
|
expect(Riddle::Query).to receive(:snippets).
|
31
|
-
with('all of the words', 'index', 'all words',
|
31
|
+
with('all of the words', 'index', 'all words', {
|
32
32
|
:before_match => '<b>', :after_match => '</span>',
|
33
|
-
:chunk_separator => ' -- '
|
33
|
+
:chunk_separator => ' -- '
|
34
|
+
}).
|
34
35
|
and_return('CALL SNIPPETS')
|
35
36
|
|
36
37
|
excerpter.excerpt!('all of the words')
|
@@ -19,7 +19,7 @@ describe ThinkingSphinx::Index do
|
|
19
19
|
|
20
20
|
it "creates an ActiveRecord index" do
|
21
21
|
expect(ThinkingSphinx::ActiveRecord::Index).to receive(:new).
|
22
|
-
with(:user, :with => :active_record).and_return index
|
22
|
+
with(:user, { :with => :active_record }).and_return index
|
23
23
|
|
24
24
|
ThinkingSphinx::Index.define(:user, :with => :active_record)
|
25
25
|
end
|
@@ -100,7 +100,7 @@ describe ThinkingSphinx::Index do
|
|
100
100
|
|
101
101
|
it "creates a real-time index" do
|
102
102
|
expect(ThinkingSphinx::RealTime::Index).to receive(:new).
|
103
|
-
with(:user, :with => :real_time).and_return index
|
103
|
+
with(:user, { :with => :real_time }).and_return index
|
104
104
|
|
105
105
|
ThinkingSphinx::Index.define(:user, :with => :real_time)
|
106
106
|
end
|
@@ -61,7 +61,7 @@ describe ThinkingSphinx::Middlewares::SphinxQL do
|
|
61
61
|
allow(index_set.first).to receive_messages :reference => :user
|
62
62
|
|
63
63
|
expect(set_class).to receive(:new).
|
64
|
-
with(:classes => [klass], :indices => ['user_core']).
|
64
|
+
with({ :classes => [klass], :indices => ['user_core'] }).
|
65
65
|
and_return(index_set)
|
66
66
|
|
67
67
|
middleware.call [context]
|
@@ -215,7 +215,7 @@ describe ThinkingSphinx::Middlewares::SphinxQL do
|
|
215
215
|
end
|
216
216
|
|
217
217
|
it "filters out deleted values by default" do
|
218
|
-
expect(sphinx_sql).to receive(:where).with(:sphinx_deleted => false).
|
218
|
+
expect(sphinx_sql).to receive(:where).with({ :sphinx_deleted => false }).
|
219
219
|
and_return(sphinx_sql)
|
220
220
|
|
221
221
|
middleware.call [context]
|
@@ -253,7 +253,7 @@ describe ThinkingSphinx::Middlewares::SphinxQL do
|
|
253
253
|
search.options[:with_all] = {:tag_ids => [1, 7]}
|
254
254
|
|
255
255
|
expect(sphinx_sql).to receive(:where_all).
|
256
|
-
with(:tag_ids => [1, 7]).and_return(sphinx_sql)
|
256
|
+
with({ :tag_ids => [1, 7] }).and_return(sphinx_sql)
|
257
257
|
|
258
258
|
middleware.call [context]
|
259
259
|
end
|
@@ -262,7 +262,7 @@ describe ThinkingSphinx::Middlewares::SphinxQL do
|
|
262
262
|
search.options[:without_all] = {:tag_ids => [1, 7]}
|
263
263
|
|
264
264
|
expect(sphinx_sql).to receive(:where_not_all).
|
265
|
-
with(:tag_ids => [1, 7]).and_return(sphinx_sql)
|
265
|
+
with({ :tag_ids => [1, 7] }).and_return(sphinx_sql)
|
266
266
|
|
267
267
|
middleware.call [context]
|
268
268
|
end
|
@@ -45,7 +45,7 @@ describe ThinkingSphinx::Panes::ExcerptsPane do
|
|
45
45
|
search.options[:excerpts] = {:before_match => 'foo'}
|
46
46
|
|
47
47
|
expect(ThinkingSphinx::Excerpter).to receive(:new).
|
48
|
-
with(anything, anything, :before_match => 'foo').and_return(excerpter)
|
48
|
+
with(anything, anything, { :before_match => 'foo' }).and_return(excerpter)
|
49
49
|
|
50
50
|
pane.excerpts
|
51
51
|
end
|
@@ -49,7 +49,7 @@ describe ThinkingSphinx::RealTime::Interpreter do
|
|
49
49
|
|
50
50
|
it "passes through options to the attribute" do
|
51
51
|
expect(ThinkingSphinx::RealTime::Attribute).to receive(:new).
|
52
|
-
with(column, :as => :other_name).and_return(attribute)
|
52
|
+
with(column, { :as => :other_name }).and_return(attribute)
|
53
53
|
|
54
54
|
instance.has column, :as => :other_name
|
55
55
|
end
|
@@ -84,7 +84,7 @@ describe ThinkingSphinx::RealTime::Interpreter do
|
|
84
84
|
|
85
85
|
it "passes through options to the field" do
|
86
86
|
expect(ThinkingSphinx::RealTime::Field).to receive(:new).
|
87
|
-
with(column, :as => :other_name).and_return(field)
|
87
|
+
with(column, { :as => :other_name }).and_return(field)
|
88
88
|
|
89
89
|
instance.indexes column, :as => :other_name
|
90
90
|
end
|
@@ -112,7 +112,7 @@ describe ThinkingSphinx::RealTime::Interpreter do
|
|
112
112
|
|
113
113
|
it "adds the _sort suffix to the field's name" do
|
114
114
|
expect(ThinkingSphinx::RealTime::Attribute).to receive(:new).
|
115
|
-
with(column, :as => :col_sort, :type => :string).
|
115
|
+
with(column, { :as => :col_sort, :type => :string }).
|
116
116
|
and_return(attribute)
|
117
117
|
|
118
118
|
instance.indexes column, :sortable => true
|
@@ -120,7 +120,7 @@ describe ThinkingSphinx::RealTime::Interpreter do
|
|
120
120
|
|
121
121
|
it "respects given aliases" do
|
122
122
|
expect(ThinkingSphinx::RealTime::Attribute).to receive(:new).
|
123
|
-
with(column, :as => :other_sort, :type => :string).
|
123
|
+
with(column, { :as => :other_sort, :type => :string }).
|
124
124
|
and_return(attribute)
|
125
125
|
|
126
126
|
instance.indexes column, :sortable => true, :as => :other
|
@@ -128,7 +128,7 @@ describe ThinkingSphinx::RealTime::Interpreter do
|
|
128
128
|
|
129
129
|
it "respects symbols instead of columns" do
|
130
130
|
expect(ThinkingSphinx::RealTime::Attribute).to receive(:new).
|
131
|
-
with(:title, :as => :title_sort, :type => :string).
|
131
|
+
with(:title, { :as => :title_sort, :type => :string }).
|
132
132
|
and_return(attribute)
|
133
133
|
|
134
134
|
instance.indexes :title, :sortable => true
|
@@ -16,7 +16,7 @@ describe ThinkingSphinx do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "passes through the given query and options" do
|
19
|
-
expect(ThinkingSphinx::Search).to receive(:new).with('foo', :bar => :baz).
|
19
|
+
expect(ThinkingSphinx::Search).to receive(:new).with('foo', { :bar => :baz }).
|
20
20
|
and_return(search)
|
21
21
|
|
22
22
|
ThinkingSphinx.count('foo', :bar => :baz)
|
@@ -35,7 +35,7 @@ describe ThinkingSphinx do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it "passes through the given query and options" do
|
38
|
-
expect(ThinkingSphinx::Search).to receive(:new).with('foo', :bar => :baz).
|
38
|
+
expect(ThinkingSphinx::Search).to receive(:new).with('foo', { :bar => :baz }).
|
39
39
|
and_return(search)
|
40
40
|
|
41
41
|
ThinkingSphinx.search('foo', :bar => :baz)
|
data/thinking-sphinx.gemspec
CHANGED
@@ -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 = '5.
|
8
|
+
s.version = '5.6.0'
|
9
9
|
s.platform = Gem::Platform::RUBY
|
10
10
|
s.authors = ["Pat Allan"]
|
11
11
|
s.email = ["pat@freelancing-gods.com"]
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
|
31
31
|
s.add_development_dependency 'appraisal', '~> 1.0.2'
|
32
32
|
s.add_development_dependency 'combustion', '~> 1.1'
|
33
|
-
s.add_development_dependency 'database_cleaner', '~>
|
34
|
-
s.add_development_dependency 'rspec', '~> 3.
|
33
|
+
s.add_development_dependency 'database_cleaner', '~> 2.0.2'
|
34
|
+
s.add_development_dependency 'rspec', '~> 3.12.0'
|
35
35
|
s.add_development_dependency 'rspec-retry', '~> 0.5.6'
|
36
36
|
end
|
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: 5.
|
4
|
+
version: 5.6.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:
|
11
|
+
date: 2024-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -128,28 +128,28 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 2.0.2
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 2.0.2
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: rspec
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 3.
|
145
|
+
version: 3.12.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 3.
|
152
|
+
version: 3.12.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rspec-retry
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|