Permalink
Browse files

adding CouchtinyAdapter. Id type is string instead of integer.

  • Loading branch information...
1 parent cf20507 commit b96af99f1813a5120abcde92fcc928ef7f7a87f6 @opusmagnum committed Nov 11, 2010
Showing with 10 additions and 7 deletions.
  1. +1 −0 lib/xapit.rb
  2. +7 −6 lib/xapit/adapters/couchtiny_adapter.rb
  3. +2 −1 lib/xapit/collection.rb
View
@@ -69,3 +69,4 @@ def self.serialize_value(value)
require File.dirname(__FILE__) + '/xapit/adapters/abstract_adapter'
require File.dirname(__FILE__) + '/xapit/adapters/active_record_adapter'
require File.dirname(__FILE__) + '/xapit/adapters/data_mapper_adapter'
+require File.dirname(__FILE__) + '/xapit/adapters/couchtiny_adapter'
@@ -13,7 +13,7 @@ def find_single(id)
# Get multiple documents
def find_multiple(ids)
- @target.all(:keys => ids)
+ @target.bulk_get(:keys => ids)
end
# Use CouchRest pagination for batched find_each
@@ -25,18 +25,19 @@ def find_each(view = :all, query = {}, &block)
batch_size = 200
end
- begin
+# begin
# Fetch one batch of records
- collection = @target.view(view, query).paginate(
- :page => page, :per_page => batch_size
- )
+ collection = @target.all
+ # collection = @target.view(view, query).paginate(
+ # :page => page, :per_page => batch_size
+ # )
collection.each do |record|
yield record
end
page += 1
- end while not collection.empty?
+ # end while not collection.empty?
end
end
end
View
@@ -178,7 +178,8 @@ def fetch_results(options = {})
end
matches.map do |match|
class_name, id = match.document.data.split('-')
- member = records_by_class[class_name].detect { |m| m.id == id.to_i }
+ ###member = records_by_class[class_name].detect { |m| m.id == id.to_i }
+ member = records_by_class[class_name].detect { |m| m.id == id.to_s }
member.xapit_relevance = match.percent
member
end

0 comments on commit b96af99

Please sign in to comment.