tire 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/.travis.yml +18 -2
  2. data/README.markdown +2 -2
  3. data/examples/tire-dsl.rb +1 -1
  4. data/lib/tire.rb +1 -0
  5. data/lib/tire/http/clients/faraday.rb +71 -0
  6. data/lib/tire/index.rb +30 -7
  7. data/lib/tire/logger.rb +1 -1
  8. data/lib/tire/model/persistence.rb +2 -3
  9. data/lib/tire/model/persistence/finders.rb +2 -2
  10. data/lib/tire/model/persistence/storage.rb +3 -5
  11. data/lib/tire/model/search.rb +2 -0
  12. data/lib/tire/results/collection.rb +8 -8
  13. data/lib/tire/results/item.rb +4 -1
  14. data/lib/tire/search.rb +30 -2
  15. data/lib/tire/search/facet.rb +5 -1
  16. data/lib/tire/search/query.rb +36 -1
  17. data/lib/tire/search/script_field.rb +23 -0
  18. data/lib/tire/tasks.rb +1 -1
  19. data/lib/tire/version.rb +8 -15
  20. data/test/integration/dis_max_queries_test.rb +68 -0
  21. data/test/integration/facets_test.rb +27 -0
  22. data/test/integration/index_store_test.rb +17 -1
  23. data/test/integration/index_update_document_test.rb +111 -0
  24. data/test/integration/persistent_model_test.rb +13 -0
  25. data/test/integration/prefix_query_test.rb +43 -0
  26. data/test/integration/reindex_test.rb +10 -0
  27. data/test/integration/script_fields_test.rb +38 -0
  28. data/test/test_helper.rb +6 -1
  29. data/test/unit/index_test.rb +58 -5
  30. data/test/unit/model_persistence_test.rb +14 -2
  31. data/test/unit/model_search_test.rb +14 -0
  32. data/test/unit/results_item_test.rb +9 -2
  33. data/test/unit/rubyext_test.rb +6 -0
  34. data/test/unit/search_query_test.rb +61 -2
  35. data/test/unit/search_script_field_test.rb +26 -0
  36. data/test/unit/search_test.rb +46 -2
  37. data/tire.gemspec +1 -1
  38. metadata +62 -53
@@ -6,9 +6,8 @@ module Tire
6
6
 
7
7
  context "Index" do
8
8
 
9
- setup do
10
- @index = Tire::Index.new 'dummy'
11
- end
9
+ setup do @index = Tire::Index.new 'dummy' end
10
+ teardown do Tire.configure { reset } end
12
11
 
13
12
  should "have a name" do
14
13
  assert_equal 'dummy', @index.name
@@ -421,6 +420,48 @@ module Tire
421
420
 
422
421
  end
423
422
 
423
+ context "when updating" do
424
+
425
+ should "send payload" do
426
+ Configuration.client.expects(:post).with do |url,payload|
427
+ payload = MultiJson.decode(payload)
428
+ # p [url, payload]
429
+ assert_equal( "#{@index.url}/document/42/_update", url ) &&
430
+ assert_not_nil( payload['script'] ) &&
431
+ assert_not_nil( payload['params'] ) &&
432
+ assert_equal( '21', payload['params']['bar'] )
433
+ end.
434
+ returns(
435
+ mock_response('{"ok":"true","_index":"dummy","_type":"document","_id":"42","_version":"2"}'))
436
+
437
+ assert @index.update('document', '42', {:script => "ctx._source.foo = bar;", :params => { :bar => '21' }})
438
+ end
439
+
440
+ should "send options" do
441
+ Configuration.client.expects(:post).with do |url,payload|
442
+ payload = MultiJson.decode(payload)
443
+ # p [url, payload]
444
+ assert_equal( "#{@index.url}/document/42/_update?timeout=1000", url ) &&
445
+ assert_nil( payload['timeout'] )
446
+ end.
447
+ returns(
448
+ mock_response('{"ok":"true","_index":"dummy","_type":"document","_id":"42","_version":"2"}'))
449
+ assert @index.update('document', '42', {:script => "ctx._source.foo = 'bar'"}, {:timeout => 1000})
450
+ end
451
+
452
+ should "raise error when no type or ID is passed" do
453
+ assert_raise(ArgumentError) { @index.update('article', nil, :script => 'foobar') }
454
+ assert_raise(ArgumentError) { @index.update(nil, '123', :script => 'foobar') }
455
+ end
456
+
457
+ should "raise an error when no script is passed" do
458
+ assert_raise ArgumentError do
459
+ @index.update('article', "42", {:params => {"foo" => "bar"}})
460
+ end
461
+ end
462
+
463
+ end
464
+
424
465
  context "when storing in bulk" do
425
466
  # The expected JSON looks like this:
426
467
  #
@@ -523,6 +564,17 @@ module Tire
523
564
  ActiveModelArticle.index.bulk_store documents
524
565
  end
525
566
 
567
+ should "log the response code" do
568
+ Tire.configure { logger STDERR }
569
+ Configuration.client.expects(:post).returns(mock_response('{}'), 200)
570
+
571
+ Configuration.logger.expects(:log_response).with do |status, took, body|
572
+ status == 200
573
+ end
574
+
575
+ @index.bulk_store [ {:id => '1', :title => 'One'}, {:id => '2', :title => 'Two'} ]
576
+ end
577
+
526
578
  end
527
579
 
528
580
  context "when importing" do
@@ -823,10 +875,10 @@ module Tire
823
875
  def index_something
824
876
  @tags = ['block', 'scope', 'revenge']
825
877
 
826
- Index.any_instance.expects(:store).with(title: 'Title From Outer Space', tags: ['block', 'scope', 'revenge'])
878
+ Index.any_instance.expects(:store).with(:title => 'Title From Outer Space', :tags => ['block', 'scope', 'revenge'])
827
879
 
828
880
  Tire::Index.new 'outer-space' do |index|
829
- index.store title: @my_title, tags: @tags
881
+ index.store :title => @my_title, :tags => @tags
830
882
  end
831
883
  end
832
884
 
@@ -834,6 +886,7 @@ module Tire
834
886
  end
835
887
 
836
888
  end
889
+
837
890
  end
838
891
 
839
892
  end
@@ -307,6 +307,17 @@ module Tire
307
307
 
308
308
  end
309
309
 
310
+ context "when initializing" do
311
+
312
+ should "be a new record" do
313
+ article = PersistentArticle.new :title => 'Test'
314
+
315
+ assert article.new_record?, "#{article.inspect} should be `new_record?`"
316
+ assert ! article.persisted?, "#{article.inspect} should NOT be `persisted?`"
317
+ end
318
+
319
+ end
320
+
310
321
  context "when creating" do
311
322
 
312
323
  should "save the document with generated ID in the database" do
@@ -318,10 +329,11 @@ module Tire
318
329
  doc['tags'] == ['one', 'two']
319
330
  doc['published_on'] == nil
320
331
  end.
321
- returns(mock_response('{"ok":true,"_id":"abc123"}'))
332
+ returns(mock_response('{"ok":true,"_id":"abc123","_version":1}'))
322
333
  article = PersistentArticle.create :title => 'Test', :tags => [:one, :two]
323
334
 
324
- assert article.persisted?, "#{article.inspect} should be `persisted?`"
335
+ assert article.persisted?, "#{article.inspect} should be `persisted?`"
336
+ assert ! article.new_record?, "#{article.inspect} should NOT be `new_record?`"
325
337
  assert_equal 'abc123', article.id
326
338
  end
327
339
 
@@ -153,6 +153,14 @@ module Tire
153
153
  end
154
154
  end
155
155
 
156
+ should "allow to pass :version option" do
157
+ Tire::Search::Search.any_instance.expects(:version).with(true)
158
+
159
+ ActiveModelArticle.search :version => true do
160
+ query { all }
161
+ end
162
+ end
163
+
156
164
  end
157
165
 
158
166
  context "searching with query string" do
@@ -221,6 +229,12 @@ module Tire
221
229
  ActiveModelArticle.search @q, :fields => ['id', 'title']
222
230
  end
223
231
 
232
+ should "allow to pass :version option" do
233
+ Tire::Search::Search.any_instance.expects(:version).with(true)
234
+
235
+ ActiveModelArticle.search @q, :version => true
236
+ end
237
+
224
238
  end
225
239
 
226
240
  should "not set callback when hooks are missing" do
@@ -15,7 +15,9 @@ module Tire
15
15
  context "Item" do
16
16
 
17
17
  setup do
18
- @document = Results::Item.new :title => 'Test', :author => { :name => 'Kafka' }
18
+ @document = Results::Item.new :title => 'Test',
19
+ :author => { :name => 'Kafka' },
20
+ :awards => { :best_fiction => { :year => '1925' } }
19
21
  end
20
22
 
21
23
  should "be initialized with a Hash or Hash like object" do
@@ -106,10 +108,15 @@ module Tire
106
108
 
107
109
  should "be convertible to hash" do
108
110
  assert_instance_of Hash, @document.to_hash
111
+ assert_instance_of Hash, @document.to_hash[:author]
112
+ assert_instance_of Hash, @document.to_hash[:awards][:best_fiction]
113
+
114
+ assert_equal 'Kafka', @document.to_hash[:author][:name]
115
+ assert_equal '1925', @document.to_hash[:awards][:best_fiction][:year]
109
116
  end
110
117
 
111
118
  should "be inspectable" do
112
- assert_match /<Item title|Item author/, @document.inspect
119
+ assert_match /<Item .* title|Item .* author/, @document.inspect
113
120
  end
114
121
 
115
122
  context "within Rails" do
@@ -55,6 +55,12 @@ module Tire
55
55
 
56
56
  end
57
57
 
58
+ context "Ruby Test::Unit" do
59
+ should "actually return true from assert..." do
60
+ assert_equal true, assert(true)
61
+ end
62
+ end
63
+
58
64
  end
59
65
 
60
66
  end
@@ -113,7 +113,7 @@ module Tire::Search
113
113
  Query.new.ids([1, 2], 'foo') )
114
114
  end
115
115
  end
116
-
116
+
117
117
  context "FuzzyQuery" do
118
118
 
119
119
  should "allow a fuzzy search" do
@@ -236,7 +236,66 @@ module Tire::Search
236
236
  end
237
237
  end
238
238
 
239
+ context "Prefix query" do
240
+ should "allow search for a prefix" do
241
+ assert_equal( { :prefix => { :user => "foo" } }, Query.new.prefix(:user, "foo") )
242
+ end
243
+
244
+ should "allow setting boost for prefix" do
245
+ assert_equal( { :prefix => {:user => {:prefix => "foo", :boost => 2.0 } } },
246
+ Query.new.prefix(:user, "foo", :boost => 2.0) )
247
+ end
248
+ end
249
+
239
250
  end
240
- end
241
251
 
252
+ context "DisMaxQuery" do
253
+
254
+ should "not raise an error when no block is given" do
255
+ assert_nothing_raised { Query.new.dis_max }
256
+ end
257
+
258
+ should "encode options" do
259
+ query = Query.new.dis_max(:tie_breaker => 0.7) do
260
+ query { string 'foo' }
261
+ end
262
+
263
+ assert_equal 0.7, query[:dis_max][:tie_breaker]
264
+ end
265
+
266
+ should "wrap single query" do
267
+ assert_equal( { :dis_max => {:queries => [{ :query_string => { :query => 'foo' } }] }},
268
+ Query.new.dis_max { query { string 'foo' } } )
269
+ end
270
+
271
+ should "wrap multiple queries" do
272
+ query = Query.new.dis_max do
273
+ query { string 'foo' }
274
+ query { string 'bar' }
275
+ query { string 'baz' }
276
+ end
277
+
278
+ assert_equal 3, query[:dis_max][:queries].size
279
+
280
+ assert_equal( { :query_string => {:query => 'foo'} }, query[:dis_max][:queries][0] )
281
+ assert_equal( { :query_string => {:query => 'bar'} }, query[:dis_max][:queries][1] )
282
+ assert_equal( { :query_string => {:query => 'baz'} }, query[:dis_max][:queries][2] )
283
+ end
284
+
285
+ should "allow passing variables from outer scope" do
286
+ @q1 = 'foo'
287
+ @q2 = 'bar'
288
+ query = Query.new.dis_max do |dis_max|
289
+ dis_max.query { |query| query.string @q1 }
290
+ dis_max.query { |query| query.string @q2 }
291
+ end
292
+
293
+ assert_equal( 2, query[:dis_max][:queries].size, query[:dis_max][:queries].inspect )
294
+ assert_equal( { :query_string => {:query => 'foo'} }, query[:dis_max][:queries].first )
295
+ assert_equal( { :query_string => {:query => 'bar'} }, query[:dis_max][:queries].last )
296
+ end
297
+
298
+ end
299
+
300
+ end
242
301
  end
@@ -0,0 +1,26 @@
1
+ require 'test_helper'
2
+
3
+ module Tire::Search
4
+
5
+ class ScriptFieldTest < Test::Unit::TestCase
6
+
7
+ context "ScriptField" do
8
+
9
+ should "be serialized to JSON" do
10
+ assert_respond_to ScriptField.new(:test1, {}), :to_json
11
+ end
12
+
13
+ should "encode simple declarations as JSON" do
14
+ assert_equal( { :test1 => { :script => "doc['my_field_name'].value * factor",
15
+ :params => { :factor => 2.2 }, :lang => :js } }.to_json,
16
+
17
+ ScriptField.new( :test1,
18
+ { :script => "doc['my_field_name'].value * factor",
19
+ :params => { :factor => 2.2 }, :lang => :js } ).to_json
20
+ )
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+ end
@@ -17,6 +17,14 @@ module Tire
17
17
  assert_match %r|/index1,index2/_search|, s.url
18
18
  end
19
19
 
20
+ should "be initialized with multiple indices with options" do
21
+ indices = {'index1' => {:boost => 1},'index2' => {:boost => 2}}
22
+ s = Search::Search.new(indices) { query { string 'foo' } }
23
+ assert_match /index1/, s.url
24
+ assert_match /index2/, s.url
25
+ assert_equal({'index1' => 1, 'index2' => 2}, s.to_hash[:indices_boost])
26
+ end
27
+
20
28
  should "be initialized with multiple indices as string" do
21
29
  s = Search::Search.new(['index1,index2,index3']) { query { string 'foo' } }
22
30
  assert_match %r|/index1,index2,index3/_search|, s.url
@@ -137,7 +145,8 @@ module Tire
137
145
  sort { by :title, 'desc' }.
138
146
  size(5).
139
147
  sort { by :name, 'asc' }.
140
- from(1)
148
+ from(1).
149
+ version(true)
141
150
  end
142
151
  end
143
152
 
@@ -149,6 +158,7 @@ module Tire
149
158
  s = Search::Search.new('index')
150
159
  assert_not_nil s.results
151
160
  assert_not_nil s.response
161
+ assert_not_nil s.json
152
162
  end
153
163
 
154
164
  should "allow the search criteria to be chained" do
@@ -315,7 +325,7 @@ module Tire
315
325
 
316
326
  context "with version" do
317
327
 
318
- should "set the version value in options" do
328
+ should "set the version" do
319
329
  s = Search::Search.new('index') do
320
330
  version true
321
331
  end
@@ -450,6 +460,40 @@ module Tire
450
460
 
451
461
  end
452
462
 
463
+ context "script field" do
464
+
465
+ should "allow to specify script field" do
466
+ s = Search::Search.new('index') do
467
+ script_field :test1, :script => "doc['my_field_name'].value * 2"
468
+ end
469
+
470
+ assert_equal 1, s.script_fields.size
471
+
472
+ assert_not_nil s.script_fields
473
+ assert_not_nil s.script_fields[:test1]
474
+
475
+ assert_equal( {:test1 => { :script => "doc['my_field_name'].value * 2" }}.to_json,
476
+ s.to_hash[:script_fields].to_json )
477
+ end
478
+
479
+ should "allow to add multiple script fields" do
480
+ s = Search::Search.new('index') do
481
+ script_field :field1, :script => "doc['my_field_name'].value * 2"
482
+ script_field :field2, :script => "doc['other_field_name'].value * 3"
483
+ end
484
+
485
+ assert_equal 2, s.script_fields.size
486
+
487
+ assert_not_nil s.script_fields[:field1]
488
+ assert_not_nil s.script_fields[:field2]
489
+
490
+ assert_equal( { :field1 => { :script => "doc['my_field_name'].value * 2" }, :field2 => { :script => "doc['other_field_name'].value * 3" } }.to_json,
491
+ s.to_hash[:script_fields].to_json )
492
+ end
493
+
494
+ end
495
+
496
+
453
497
  end
454
498
 
455
499
  end
data/tire.gemspec CHANGED
@@ -46,12 +46,12 @@ Gem::Specification.new do |s|
46
46
  s.add_development_dependency "redis-persistence"
47
47
  s.add_development_dependency "curb"
48
48
  s.add_development_dependency "minitest"
49
+ s.add_development_dependency "turn", "~> 0.9" if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
49
50
 
50
51
  # These gems are not needed for CI at <http://travis-ci.org/#!/karmi/tire>
51
52
  #
52
53
  unless ENV["CI"]
53
54
  s.add_development_dependency "rdoc"
54
- s.add_development_dependency "turn", "~> 0.9" if defined?(RUBY_VERSION) && RUBY_VERSION > '1.9'
55
55
  end
56
56
 
57
57
  s.description = <<-DESC
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-04 00:00:00.000000000 Z
12
+ date: 2012-09-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70096833142860 !ruby/object:Gem::Requirement
16
+ requirement: &70101223876780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70096833142860
24
+ version_requirements: *70101223876780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rest-client
27
- requirement: &70096833142140 !ruby/object:Gem::Requirement
27
+ requirement: &70101223875800 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.6'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70096833142140
35
+ version_requirements: *70101223875800
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: multi_json
38
- requirement: &70096833140840 !ruby/object:Gem::Requirement
38
+ requirement: &70101223874160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '1.0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70096833140840
46
+ version_requirements: *70101223874160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: activemodel
49
- requirement: &70096833140320 !ruby/object:Gem::Requirement
49
+ requirement: &70101223873120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '3.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70096833140320
57
+ version_requirements: *70101223873120
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: hashr
60
- requirement: &70096833139860 !ruby/object:Gem::Requirement
60
+ requirement: &70101223871460 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.0.19
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70096833139860
68
+ version_requirements: *70101223871460
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
- requirement: &70096833139320 !ruby/object:Gem::Requirement
71
+ requirement: &70101223892960 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '1.0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70096833139320
79
+ version_requirements: *70101223892960
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: yajl-ruby
82
- requirement: &70096833138860 !ruby/object:Gem::Requirement
82
+ requirement: &70101223891900 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '1.0'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70096833138860
90
+ version_requirements: *70101223891900
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: shoulda
93
- requirement: &70096833138480 !ruby/object:Gem::Requirement
93
+ requirement: &70101223891340 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *70096833138480
101
+ version_requirements: *70101223891340
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: mocha
104
- requirement: &70096833137960 !ruby/object:Gem::Requirement
104
+ requirement: &70101223890580 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *70096833137960
112
+ version_requirements: *70101223890580
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: activerecord
115
- requirement: &70096833137400 !ruby/object:Gem::Requirement
115
+ requirement: &70101223889780 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '3.0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *70096833137400
123
+ version_requirements: *70101223889780
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: sqlite3
126
- requirement: &70096833136840 !ruby/object:Gem::Requirement
126
+ requirement: &70101223889140 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *70096833136840
134
+ version_requirements: *70101223889140
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: mongoid
137
- requirement: &70096833131700 !ruby/object:Gem::Requirement
137
+ requirement: &70101223888360 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '2.2'
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *70096833131700
145
+ version_requirements: *70101223888360
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: bson_ext
148
- requirement: &70096833131100 !ruby/object:Gem::Requirement
148
+ requirement: &70101223887740 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *70096833131100
156
+ version_requirements: *70101223887740
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: redis-persistence
159
- requirement: &70096833130080 !ruby/object:Gem::Requirement
159
+ requirement: &70101223887020 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *70096833130080
167
+ version_requirements: *70101223887020
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: curb
170
- requirement: &70096833129280 !ruby/object:Gem::Requirement
170
+ requirement: &70101223886480 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ! '>='
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: '0'
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *70096833129280
178
+ version_requirements: *70101223886480
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: minitest
181
- requirement: &70096833128320 !ruby/object:Gem::Requirement
181
+ requirement: &70101223885880 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ! '>='
@@ -186,29 +186,29 @@ dependencies:
186
186
  version: '0'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *70096833128320
189
+ version_requirements: *70101223885880
190
190
  - !ruby/object:Gem::Dependency
191
- name: rdoc
192
- requirement: &70096833127440 !ruby/object:Gem::Requirement
191
+ name: turn
192
+ requirement: &70101223907180 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
- - - ! '>='
195
+ - - ~>
196
196
  - !ruby/object:Gem::Version
197
- version: '0'
197
+ version: '0.9'
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *70096833127440
200
+ version_requirements: *70101223907180
201
201
  - !ruby/object:Gem::Dependency
202
- name: turn
203
- requirement: &70096833125920 !ruby/object:Gem::Requirement
202
+ name: rdoc
203
+ requirement: &70101223906080 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
- - - ~>
206
+ - - ! '>='
207
207
  - !ruby/object:Gem::Version
208
- version: '0.9'
208
+ version: '0'
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *70096833125920
211
+ version_requirements: *70101223906080
212
212
  description: ! " Tire is a Ruby client for the ElasticSearch search engine/database.\n\n
213
213
  \ It provides Ruby-like API for fluent communication with the ElasticSearch server\n
214
214
  \ and blends with ActiveModel class for convenient usage in Rails applications.\n\n
@@ -238,6 +238,7 @@ files:
238
238
  - lib/tire/dsl.rb
239
239
  - lib/tire/http/client.rb
240
240
  - lib/tire/http/clients/curb.rb
241
+ - lib/tire/http/clients/faraday.rb
241
242
  - lib/tire/http/response.rb
242
243
  - lib/tire/index.rb
243
244
  - lib/tire/logger.rb
@@ -263,6 +264,7 @@ files:
263
264
  - lib/tire/search/highlight.rb
264
265
  - lib/tire/search/query.rb
265
266
  - lib/tire/search/scan.rb
267
+ - lib/tire/search/script_field.rb
266
268
  - lib/tire/search/sort.rb
267
269
  - lib/tire/tasks.rb
268
270
  - lib/tire/utils.rb
@@ -278,6 +280,7 @@ files:
278
280
  - test/integration/boolean_queries_test.rb
279
281
  - test/integration/count_test.rb
280
282
  - test/integration/custom_score_queries_test.rb
283
+ - test/integration/dis_max_queries_test.rb
281
284
  - test/integration/dsl_search_test.rb
282
285
  - test/integration/explanation_test.rb
283
286
  - test/integration/facets_test.rb
@@ -288,15 +291,18 @@ files:
288
291
  - test/integration/index_aliases_test.rb
289
292
  - test/integration/index_mapping_test.rb
290
293
  - test/integration/index_store_test.rb
294
+ - test/integration/index_update_document_test.rb
291
295
  - test/integration/mongoid_searchable_test.rb
292
296
  - test/integration/percolator_test.rb
293
297
  - test/integration/persistent_model_test.rb
298
+ - test/integration/prefix_query_test.rb
294
299
  - test/integration/query_return_version_test.rb
295
300
  - test/integration/query_string_test.rb
296
301
  - test/integration/range_queries_test.rb
297
302
  - test/integration/reindex_test.rb
298
303
  - test/integration/results_test.rb
299
304
  - test/integration/scan_test.rb
305
+ - test/integration/script_fields_test.rb
300
306
  - test/integration/sort_test.rb
301
307
  - test/integration/text_query_test.rb
302
308
  - test/models/active_model_article.rb
@@ -333,6 +339,7 @@ files:
333
339
  - test/unit/search_highlight_test.rb
334
340
  - test/unit/search_query_test.rb
335
341
  - test/unit/search_scan_test.rb
342
+ - test/unit/search_script_field_test.rb
336
343
  - test/unit/search_sort_test.rb
337
344
  - test/unit/search_test.rb
338
345
  - test/unit/tire_test.rb
@@ -341,15 +348,12 @@ homepage: http://github.com/karmi/tire
341
348
  licenses: []
342
349
  post_install_message: ! "================================================================================\n\n
343
350
  \ Please check the documentation at <http://karmi.github.com/tire/>.\n\n--------------------------------------------------------------------------------\n\n
344
- \ IMPORTANT CHANGES LATELY:\n\n Version 0.4.1\n -------------\n * Added a Index#settings
345
- method to retrieve index settings as a Hash\n * Added support for the \"scan\"
346
- search in the Ruby API\n * Added support for reindexing the index documents into
347
- new index\n * Added basic support for index aliases\n * Changed, that Index#bulk_store
348
- runs against an index endpoint, not against `/_bulk`\n * Refactorings, fixes, Ruby
349
- 1.8 compatibility\n\n Version 0.4.2\n -------------\n * Fixed incorrect handling
350
- of PUT requests in the Curb client\n * Fixed, that blocks passed to `Tire::Index.new`
351
- or `Tire.index` losed the scope\n * Added `Tire::Alias`, interface and DSL to manage
352
- aliases as resources\n\n See the full changelog at <http://github.com/karmi/tire/commits/v0.4.2>.\n\n--------------------------------------------------------------------------------\n"
351
+ \ IMPORTANT CHANGES LATELY:\n\n * Added a prefix query\n * Added support for \"script
352
+ fields\" (return a script evaluation for each hit)\n * Added support for the Update
353
+ API in Tire::Index\n * [FIX] Fixed incorrect `Results::Item#to_hash` serialization\n
354
+ \ * 730813f Added support for aggregating over multiple fields in the \"terms\"
355
+ facet\n * Added the \"Dis Max Query\"\n * Added the ability to transform documents
356
+ when reindexing\n\n See the full changelog at <http://github.com/karmi/tire/commits/v0.4.3>.\n\n--------------------------------------------------------------------------------\n"
353
357
  rdoc_options:
354
358
  - --charset=UTF-8
355
359
  require_paths:
@@ -384,6 +388,7 @@ test_files:
384
388
  - test/integration/boolean_queries_test.rb
385
389
  - test/integration/count_test.rb
386
390
  - test/integration/custom_score_queries_test.rb
391
+ - test/integration/dis_max_queries_test.rb
387
392
  - test/integration/dsl_search_test.rb
388
393
  - test/integration/explanation_test.rb
389
394
  - test/integration/facets_test.rb
@@ -394,15 +399,18 @@ test_files:
394
399
  - test/integration/index_aliases_test.rb
395
400
  - test/integration/index_mapping_test.rb
396
401
  - test/integration/index_store_test.rb
402
+ - test/integration/index_update_document_test.rb
397
403
  - test/integration/mongoid_searchable_test.rb
398
404
  - test/integration/percolator_test.rb
399
405
  - test/integration/persistent_model_test.rb
406
+ - test/integration/prefix_query_test.rb
400
407
  - test/integration/query_return_version_test.rb
401
408
  - test/integration/query_string_test.rb
402
409
  - test/integration/range_queries_test.rb
403
410
  - test/integration/reindex_test.rb
404
411
  - test/integration/results_test.rb
405
412
  - test/integration/scan_test.rb
413
+ - test/integration/script_fields_test.rb
406
414
  - test/integration/sort_test.rb
407
415
  - test/integration/text_query_test.rb
408
416
  - test/models/active_model_article.rb
@@ -439,6 +447,7 @@ test_files:
439
447
  - test/unit/search_highlight_test.rb
440
448
  - test/unit/search_query_test.rb
441
449
  - test/unit/search_scan_test.rb
450
+ - test/unit/search_script_field_test.rb
442
451
  - test/unit/search_sort_test.rb
443
452
  - test/unit/search_test.rb
444
453
  - test/unit/tire_test.rb