mwmitchell-rsolr 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.txt CHANGED
@@ -1,3 +1,14 @@
1
+ 0.6.5 - January 26, 2009
2
+ Removed to_mash everywhere, except for usage in RSolr::Response
3
+ Added a #close method to the Direct adapter
4
+ - this closes the connection and sets the @connection variable to nil
5
+ Removed to_mash in RSolr::Connection::Base
6
+ Changed RSolr::Response::Query::Doc to DocExt
7
+ - this no longer extends Mash
8
+ - each doc in the response now uses the #extend method to mixin the new DocExt module
9
+ Added #teardown method in direct connection test, this method closes the connection
10
+ Updated the connection test methods a bit
11
+
1
12
  0.6.4 - January 26, 2009
2
13
  Updated the mapping output for the :filters and :phrase_filters (when using the #search method)
3
14
  - now sending multiple fq's instead of one
data/examples/direct.rb CHANGED
@@ -5,7 +5,7 @@ base = File.expand_path( File.dirname(__FILE__) )
5
5
  dist = File.join(base, '..', 'apache-solr')
6
6
  home = File.join(dist, 'example', 'solr')
7
7
 
8
- solr = RSolr.connect(:direct, :home_dir=>home, :dist_dir=>dist)
8
+ solr = RSolr.connect(:adapter=>:direct, :home_dir=>home, :dist_dir=>dist)
9
9
 
10
10
  `cd ../apache-solr/example/exampledocs && ./post.sh ./*.xml`
11
11
 
data/examples/http.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # Must be executed using jruby
2
2
  require File.join(File.dirname(__FILE__), '..', 'lib', 'rsolr')
3
3
 
4
- solr = RSolr.connect(:http)
4
+ solr = RSolr.connect
5
5
 
6
6
  `cd ../apache-solr/example/exampledocs && ./post.sh ./*.xml`
7
7
 
data/lib/mash.rb CHANGED
@@ -1,6 +1,5 @@
1
-
2
- # From the ExtLib gem library: http://github.com/sam/extlib/tree/master
3
-
1
+ # This class has dubious semantics and we only have it so that people can write
2
+ # params[:key] instead of params['key'].
4
3
  class Mash < Hash
5
4
 
6
5
  # @param constructor<Object>
@@ -23,7 +23,7 @@ class RSolr::Connection::Adapter::Direct
23
23
  def initialize(opts, &block)
24
24
  @home_dir = opts[:home_dir].to_s
25
25
  opts[:data_dir] ||= File.join(@home_dir, 'data')
26
- if opts[:dist_dir]
26
+ if opts[:dist_dir] and ! opts[:jar_paths]
27
27
  # add the standard lib and dist directories to the :jar_paths
28
28
  opts[:jar_paths] = [File.join(opts[:dist_dir], 'lib'), File.join(opts[:dist_dir], 'dist')]
29
29
  end
@@ -40,6 +40,13 @@ class RSolr::Connection::Adapter::Direct
40
40
  )
41
41
  end
42
42
 
43
+ def close
44
+ if @connection
45
+ @connection.close
46
+ @connection=nil
47
+ end
48
+ end
49
+
43
50
  # send a request to the connection
44
51
  # request '/update', :wt=>:xml, '</commit>'
45
52
  def send_request(path, params={}, data=nil)
@@ -29,7 +29,7 @@ class RSolr::Connection::Base
29
29
  # sets default params etc.. - could be used as a mapping hook
30
30
  # type of request should be passed in here? -> map_params(:query, {})
31
31
  def map_params(params)
32
- {}.merge(@opts[:global_params]).merge(params).to_mash
32
+ {}.merge(@opts[:global_params]).merge(params)
33
33
  end
34
34
 
35
35
  # send request (no param mapping) to the select handler
@@ -2,7 +2,7 @@
2
2
  module RSolr::Response::Query
3
3
 
4
4
  # module for adding helper methods to each Hash document
5
- class Doc < Mash
5
+ module DocExt
6
6
 
7
7
  # Helper method to check if value/multi-values exist for a given key.
8
8
  # The value can be a string, or a RegExp
@@ -149,7 +149,7 @@ module RSolr::Response::Query
149
149
  def initialize(data)
150
150
  super(data)
151
151
  @response = @data[:response]
152
- @docs = @response[:docs].collect{ |d| Doc.new(d) }
152
+ @docs = @response[:docs].collect{ |d| d=d.to_mash; d.extend(DocExt); d }
153
153
  @num_found = @response[:numFound]
154
154
  @start = @response[:start]
155
155
  end
data/lib/rsolr.rb CHANGED
@@ -7,7 +7,7 @@ proc {|base, files|
7
7
 
8
8
  module RSolr
9
9
 
10
- VERSION = '0.6.4'
10
+ VERSION = '0.6.5'
11
11
 
12
12
  autoload :Message, 'rsolr/message'
13
13
  autoload :Response, 'rsolr/response'
@@ -20,7 +20,6 @@ module RSolr
20
20
  # opts are sent to the adapter instance (:url for http, :dist_dir for :direct etc.)
21
21
  # and to the connection instance
22
22
  def self.connect(opts={})
23
- opts = opts.to_mash
24
23
  adapter_name = opts[:adapter] ||= :http
25
24
  types = {
26
25
  :http=>'HTTP',
@@ -17,6 +17,10 @@ class ConnectionDirectTest < RSolrBaseTest
17
17
  @solr.commit
18
18
  end
19
19
 
20
+ def teardown
21
+ @solr.adapter.close
22
+ end
23
+
20
24
  end
21
25
 
22
26
  end
@@ -13,12 +13,9 @@ module ConnectionTestMethods
13
13
  #end
14
14
 
15
15
  def test_default_options
16
- target = {
17
- :select_path => '/select',
18
- :update_path => '/update',
19
- :luke_path => '/admin/luke'
20
- }
21
- assert_equal target, @solr.adapter.default_options
16
+ assert_equal '/select', @solr.adapter.default_options[:select_path]
17
+ assert_equal '/update', @solr.adapter.default_options[:update_path]
18
+ assert_equal '/admin/luke', @solr.adapter.default_options[:luke_path]
22
19
  end
23
20
 
24
21
  # setting adapter options in Solr.connect method should set them in the adapter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mwmitchell-rsolr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Mitchell