shanna-dm-sphinx-adapter 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.6.2 / 2008-12-16
2
+
3
+ * Fixed shallow .dup of riddle client errors. You need to upgrade if you are running 0.6.1.
4
+
1
5
  === 0.6.1 / 2008-12-16
2
6
 
3
7
  * The adapter returns the entire Riddle::Client#query response so document :weight and :attributes are usable.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@
3
3
  require 'rubygems'
4
4
  require 'hoe'
5
5
 
6
- Hoe.new('dm-sphinx-adapter', '0.6.1') do |p|
6
+ Hoe.new('dm-sphinx-adapter', '0.6.2') do |p|
7
7
  p.developer('Shane Hanna', 'shane.hanna@gmail.com')
8
8
  p.extra_deps = [
9
9
  ['dm-core', '~> 0.9.7']
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{dm-sphinx-adapter}
5
- s.version = "0.6.1"
5
+ s.version = "0.6.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Shane Hanna"]
@@ -37,10 +37,7 @@ module DataMapper
37
37
  # DataMapper uri or options hash.
38
38
  def initialize(name, uri_or_options)
39
39
  super # Set up defaults.
40
-
41
- options = normalize_options(uri_or_options)
42
- @client = Riddle::Client.new(options.delete(:host), options.delete(:port))
43
- options.each{|k, v| @client.method("#{k}=".to_sym).call(v) if @client.respond_to?("#{k}=".to_sym)}
40
+ @options = normalize_options(uri_or_options)
44
41
  end
45
42
 
46
43
  def create(resources) #:nodoc:
@@ -118,10 +115,15 @@ module DataMapper
118
115
  # Array<Hash>:: An array of document hashes. <tt>[{:id => 1, ...}, {:id => 2, ...}]</tt>
119
116
  # Array<>:: An empty array if no documents match.
120
117
  def read(query)
121
- from = indexes(query.model).map{|index| index.name}.join(', ')
122
- search = Sphinx::Query.new(query).to_s
118
+ from = indexes(query.model).map{|index| index.name}.join(', ')
119
+ search = Sphinx::Query.new(query).to_s
120
+ client = Riddle::Client.new(@options[:host], @options[:port])
121
+
122
+ # You can set some options that aren't set by the adapter.
123
+ @options.except(:host, :port, :match_mode, :limit, :offset, :sort_mode, :sort_by).each do |k, v|
124
+ client.method("#{k}=".to_sym).call(v) if client.respond_to?("#{k}=".to_sym)
125
+ end
123
126
 
124
- client = @client.dup
125
127
  client.match_mode = :extended
126
128
  client.filters = search_filters(query) # By attribute.
127
129
  client.limit = query.limit.to_i if query.limit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shanna-dm-sphinx-adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Hanna