From 28860f095ffe86a033b7c1cc6f86500e4765c43d Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Sun, 20 Feb 2022 11:56:13 -0800 Subject: [PATCH] Added support for non-id primary keys to resume [skip ci] --- lib/searchkick/relation_indexer.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/searchkick/relation_indexer.rb b/lib/searchkick/relation_indexer.rb index 6b17702..bc2edad 100644 --- a/lib/searchkick/relation_indexer.rb +++ b/lib/searchkick/relation_indexer.rb @@ -63,9 +63,8 @@ module Searchkick if relation.respond_to?(:primary_key) # use total docs instead of max id since there's not a great way # to get the max _id without scripting since it's a string - - # TODO use primary key and prefix with table name - relation = relation.where("id > ?", index.total_docs) + where = relation.arel_table[relation.primary_key].gt(index.total_docs) + relation = relation.where(where) else raise Error, "Resume not supported for Mongoid" end -- libgit2 0.21.0