Add search deploy date options
This commit is contained in:
parent
173b9f4fd7
commit
0ffd8acacd
4 changed files with 12 additions and 3 deletions
|
@ -3,10 +3,12 @@
|
|||
class Importer::BaseImporter
|
||||
# @param [Integer] batch_size
|
||||
# @param [Concurrent::ThreadPoolExecutor] executor
|
||||
def initialize(batch_size:, executor:, full: true)
|
||||
def initialize(batch_size:, executor:, full: true, from: nil, to: nil)
|
||||
@batch_size = batch_size
|
||||
@executor = executor
|
||||
@full = full
|
||||
@from = from.to_date if from.present?
|
||||
@to = to.to_date if to.present?
|
||||
@wait_for = Concurrent::Set.new
|
||||
end
|
||||
|
||||
|
|
|
@ -27,6 +27,9 @@ class Importer::PublicStatusesIndexImporter < Importer::BaseImporter
|
|||
end
|
||||
|
||||
def scope
|
||||
Status.indexable.reorder(nil)
|
||||
to_index = Status.indexable.reorder(nil)
|
||||
to_index = to_index.where('statuses.created_at >= ?', @from) if @from.present?
|
||||
to_index = to_index.where('statuses.created_at < ?', @to) if @to.present?
|
||||
to_index
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,6 +17,8 @@ class Importer::StatusesIndexImporter < Importer::BaseImporter
|
|||
|
||||
bulk = ActiveRecord::Base.connection_pool.with_connection do
|
||||
to_index = index.adapter.default_scope.where(id: status_ids)
|
||||
to_index = to_index.where('created_at >= ?', @from) if @from.present?
|
||||
to_index = to_index.where('created_at < ?', @to) if @to.present?
|
||||
crutches = Chewy::Index::Crutch::Crutches.new index, to_index
|
||||
to_index.map do |object|
|
||||
# This is unlikely to happen, but the post may have been
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue