rsolr-ext 0.11.0 → 0.11.1
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.
- data/lib/rsolr-ext/model.rb +3 -3
- data/lib/rsolr-ext/response/facets.rb +3 -2
- data/lib/rsolr-ext.rb +8 -14
- data/rsolr-ext.gemspec +2 -2
- data/test/connection_test.rb +1 -7
- data/test/request_test.rb +0 -3
- data/test/response_test.rb +1 -4
- metadata +2 -2
data/lib/rsolr-ext/model.rb
CHANGED
@@ -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 =
|
28
|
-
|
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.
|
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
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
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
|
-
|
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
data/test/connection_test.rb
CHANGED
@@ -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
data/test/response_test.rb
CHANGED
@@ -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.
|
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-
|
12
|
+
date: 2009-11-19 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|