Commit 28860f095ffe86a033b7c1cc6f86500e4765c43d

Authored by Andrew Kane
1 parent c7074f13

Added support for non-id primary keys to resume [skip ci]

Showing 1 changed file with 2 additions and 3 deletions   Show diff stats
lib/searchkick/relation_indexer.rb
... ... @@ -63,9 +63,8 @@ module Searchkick
63 63 if relation.respond_to?(:primary_key)
64 64 # use total docs instead of max id since there's not a great way
65 65 # to get the max _id without scripting since it's a string
66   -
67   - # TODO use primary key and prefix with table name
68   - relation = relation.where("id > ?", index.total_docs)
  66 + where = relation.arel_table[relation.primary_key].gt(index.total_docs)
  67 + relation = relation.where(where)
69 68 else
70 69 raise Error, "Resume not supported for Mongoid"
71 70 end
... ...