Skip to content

Commit

Permalink
fix: do not calculate sphinx_offset in cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
isqad committed Dec 10, 2018
1 parent 483205f commit 4e98d15
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/sphinx/integration/transmitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,14 @@ def connection
end

def sphinx_document_ids(records)
records.map do |item|
sphinx_offset = klass.sphinx_offset
indexed_models_size = ::ThinkingSphinx.context.indexed_models.size

records.map! do |item|
if item.respond_to?(:sphinx_document_id)
item.sphinx_document_id
else
item * ::ThinkingSphinx.context.indexed_models.size + klass.sphinx_offset
item * indexed_models_size + sphinx_offset
end
end
end
Expand Down

0 comments on commit 4e98d15

Please sign in to comment.