{"record":{"id":"7f0bdd65580956a4","repo":"ankane/searchkick","slug":"resume-not-supported-for-mongoid","errorCode":null,"errorMessage":"Resume not supported for Mongoid","messagePattern":"Resume not supported for Mongoid","errorType":"exception","errorClass":"Searchkick::Error","httpStatus":null,"severity":"error","filePath":"lib/searchkick/relation_indexer.rb","lineNumber":68,"sourceCode":"\n    def batches_left\n      Searchkick.with_redis { |r| r.call(\"SCARD\", batches_key) }\n    end\n\n    def batch_completed(batch_id)\n      Searchkick.with_redis { |r| r.call(\"SREM\", batches_key, [batch_id]) }\n    end\n\n    private\n\n    def resume_relation(relation)\n      if relation.respond_to?(:primary_key)\n        # use total docs instead of max id since there's not a great way\n        # to get the max _id without scripting since it's a string\n        where = relation.arel_table[relation.primary_key].gt(index.total_docs)\n        relation = relation.where(where)\n      else\n        raise Error, \"Resume not supported for Mongoid\"\n      end\n    end\n\n    def in_batches(relation)\n      if relation.respond_to?(:find_in_batches)\n        klass = relation.klass\n        # remove order to prevent possible warnings\n        relation.except(:order).find_in_batches(batch_size: batch_size) do |batch|\n          # prevent scope from affecting search_data as well as inline jobs\n          # Active Record runs relation calls in scoping block\n          # https://github.com/rails/rails/blob/main/activerecord/lib/active_record/relation/delegation.rb\n          # note: we could probably just call klass.current_scope = nil\n          # anywhere in reindex method (after initial all call),\n          # but this is more cautious\n          previous_scope = klass.current_scope(true)\n          if previous_scope\n            begin\n              klass.current_scope = nil","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/ankane/searchkick/blob/93e901a75b11a25101668a616e006b158251b16e/lib/searchkick/relation_indexer.rb#L50-L86","documentation":"Error \"Resume not supported for Mongoid\" thrown in ankane/searchkick.","triggerScenarios":"Thrown at lib/searchkick/relation_indexer.rb:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e901a75b11a25101668a616e006b158251b16e","analyzedAt":"2026-08-21T19:06:23.767Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}