2

我正在尝试重新索引我的 searchkick 模型,看起来像这样

class Collectible < ActiveRecord::Base
  searchkick suggest: ["name"], text_start: [:name], wordnet: true
   has_many   :category_collectibles, dependent: :delete_all
   has_many   :categories , :through=> :category_collectibles
   has_many   :georesults, dependent: :delete_all

   scope :search_import, -> { includes(:categories) }

  def search_data
     attributes.merge(
      states: georesults.map(&:state),
      categories: categories.map(&:name)
     )
   end

这是我的类别模型

  class Category < ActiveRecord::Base
     has_many   :category_collectibles, dependent: :delete_all
     has_many   :collectibles , :through=> :category_collectibles
  end

Category_collectible 模型

 class CategoryCollectible < ActiveRecord::Base
  belongs_to :collectible ,inverse_of: false
  belongs_to :category
 end

地理结果​​模型

class Georesult < ActiveRecord::Base
  belongs_to :collectible
  accepts_nested_attributes_for :collectible
end

我在可收藏的 georesult 表中有大约 120k 条记录,在 category_collectibles 中有大约 300k 条记录,在类别中有 500 条记录,在重新索引时我检查了我的系统内存使用情况并且正常但不知道为什么我会收到超时错误

Collectible Import (11372.8ms)  {"count":1000,"exception":["Faraday::TimeoutError","Operation timed out after 10001 milliseconds with 0 bytes received"]}
4

0 回答 0