rsolr-ext 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,13 +34,13 @@ module RSolr::Ext::Model
34
34
  end
35
35
 
36
36
  end
37
-
37
+
38
38
  #
39
- # Findable is a module that gets mixed into the SolrDocument class object.
39
+ # Findable is a module that gets mixed into the SolrDocument *class* object.
40
40
  # These methods will be available through the class like: SolrDocument.find and SolrDocument.find_by_id
41
41
  #
42
42
  module Findable
43
-
43
+
44
44
  attr_accessor :connection, :default_params
45
45
 
46
46
  def connection
@@ -24,8 +24,9 @@ module RSolr::Ext::Response::Facets
24
24
  def facets
25
25
  @facets ||= (
26
26
  facet_fields.map do |(facet_field_name,values_and_hits)|
27
- items = (values_and_hits.size/2).times.map do |index|
28
- FacetItem.new(values_and_hits[index*2], values_and_hits[index*2+1])
27
+ items = []
28
+ (values_and_hits.size/2).times do |index|
29
+ items << FacetItem.new(values_and_hits[index*2], values_and_hits[index*2+1])
29
30
  end
30
31
  FacetField.new(facet_field_name, items)
31
32
  end
data/lib/rsolr-ext.rb CHANGED
@@ -21,7 +21,7 @@ module RSolr
21
21
 
22
22
  module Ext
23
23
 
24
- VERSION = '0.11.0'
24
+ VERSION = '0.11.1'
25
25
 
26
26
  autoload :Connection, 'rsolr-ext/connection.rb'
27
27
  autoload :Doc, 'rsolr-ext/doc.rb'
@@ -29,21 +29,15 @@ module RSolr
29
29
  autoload :Response, 'rsolr-ext/response.rb'
30
30
  autoload :Model, 'rsolr-ext/model.rb'
31
31
 
32
- # c = RSolr::Ext.connect
33
- # c.find(:q=>'*:*').docs.size
34
- def self.connect(*args)
35
- connection = RSolr.connect(*args)
36
- connection.extend RSolr::Ext::Connection
37
- connection
32
+ module Connectors
33
+ [:connect, :direct_connect].each do |m|
34
+ define_method m do |*args|
35
+ RSolr.send(m, *args).extend RSolr::Ext::Connection
36
+ end
37
+ end
38
38
  end
39
39
 
40
- # c = RSolr::Ext.connect
41
- # c.find(:q=>'*:*').docs.size
42
- def self.direct_connect(*args)
43
- connection = RSolr.direct_connect(*args)
44
- connection.extend RSolr::Ext::Connection
45
- connection
46
- end
40
+ extend Connectors
47
41
 
48
42
  end
49
43
 
data/rsolr-ext.gemspec CHANGED
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = "rsolr-ext"
4
- s.version = "0.11.0"
5
- s.date = "2009-11-17"
4
+ s.version = "0.11.1"
5
+ s.date = "2009-11-19"
6
6
 
7
7
  s.summary = "An extension lib for RSolr"
8
8
  s.email = "goodieboy@gmail.com"
@@ -1,7 +1,3 @@
1
- require 'test_unit_test_case'
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'rsolr-ext')
3
- require 'helper'
4
-
5
1
  class RSolrExtConnectionTest < Test::Unit::TestCase
6
2
 
7
3
  test 'the #connect method' do
@@ -11,10 +7,8 @@ class RSolrExtConnectionTest < Test::Unit::TestCase
11
7
 
12
8
  test 'the #find method' do
13
9
  connection = RSolr::Ext.connect
14
- response = connection.find 3, 10, :q=>'*:*'#, :page=>1, :per_page=>10
10
+ response = connection.find :page=>3, :per_page=>10, :q=>'*:*'#, :page=>1, :per_page=>10
15
11
  assert response.kind_of?(Mash)
16
- #r = connection.find 3, 5, :q=>'*:*', :phrase_queries=>'rose'
17
- #assert ! r.header[:params].include?(:phrase_queries)
18
12
  end
19
13
 
20
14
  test 'the #find method with a custom request handler' do
data/test/request_test.rb CHANGED
@@ -1,6 +1,3 @@
1
- require 'test_unit_test_case'
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'rsolr-ext')
3
-
4
1
  class RSolrExtRequestTest < Test::Unit::TestCase
5
2
 
6
3
  test 'standard request' do
@@ -1,7 +1,3 @@
1
- require 'test_unit_test_case'
2
- require File.join(File.dirname(__FILE__), '..', 'lib', 'rsolr-ext')
3
- require 'helper'
4
-
5
1
  class RSolrExtResponseTest < Test::Unit::TestCase
6
2
 
7
3
  test 'base response class' do
@@ -14,6 +10,7 @@ class RSolrExtResponseTest < Test::Unit::TestCase
14
10
  test 'standard response class' do
15
11
  raw_response = eval(mock_query_response)
16
12
  r = RSolr::Ext::Response::Base.new(raw_response)
13
+
17
14
  assert r.respond_to?(:response)
18
15
  assert r.ok?
19
16
  assert_equal 11, r.docs.size
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsolr-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Mitchell
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-17 00:00:00 -05:00
12
+ date: 2009-11-19 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency