Fix post version indexer options

Up batch size to 10k to vastly improve indexing speed.
Fix reversed from and to options.
This commit is contained in:
Kira 2019-10-09 07:51:56 -07:00
parent f8b339b3b0
commit 6bfe7e12e9

View File

@ -36,11 +36,11 @@ module PostVersionIndex
module ClassMethods
def import(options = {})
q = all
q = q.where("id <= ?", options[:from]) if options[:from]
q = q.where("id >= ?", options[:to]) if options[:to]
q = q.where("id >= ?", options[:from]) if options[:from]
q = q.where("id <= ?", options[:to]) if options[:to]
q = q.where(options[:query]) if options[:query]
q.find_in_batches do |batch|
q.find_in_batches(batch_size: 10000) do |batch|
batch.map! do |pv|
{
index: {