ankane/searchkick · error · Searchkick::Error

Resume not supported for Mongoid

Error message

Resume not supported for Mongoid

What it means

Error "Resume not supported for Mongoid" thrown in ankane/searchkick.

Source

Thrown at lib/searchkick/relation_indexer.rb:68

    def batches_left
      Searchkick.with_redis { |r| r.call("SCARD", batches_key) }
    end

    def batch_completed(batch_id)
      Searchkick.with_redis { |r| r.call("SREM", batches_key, [batch_id]) }
    end

    private

    def resume_relation(relation)
      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
        where = relation.arel_table[relation.primary_key].gt(index.total_docs)
        relation = relation.where(where)
      else
        raise Error, "Resume not supported for Mongoid"
      end
    end

    def in_batches(relation)
      if relation.respond_to?(:find_in_batches)
        klass = relation.klass
        # remove order to prevent possible warnings
        relation.except(:order).find_in_batches(batch_size: batch_size) do |batch|
          # prevent scope from affecting search_data as well as inline jobs
          # Active Record runs relation calls in scoping block
          # https://github.com/rails/rails/blob/main/activerecord/lib/active_record/relation/delegation.rb
          # note: we could probably just call klass.current_scope = nil
          # anywhere in reindex method (after initial all call),
          # but this is more cautious
          previous_scope = klass.current_scope(true)
          if previous_scope
            begin
              klass.current_scope = nil

View on GitHub (pinned to 93e901a75b)

When it happens

Trigger: Thrown at lib/searchkick/relation_indexer.rb:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ankane/searchkick@93e901a75b (2026-08-21). Data as JSON: /api/errors/7f0bdd65580956a4. Report an issue: GitHub.