Skip to content

Commit 4f7133b

Browse files
Brian Kellythatbudakguy
authored andcommitted
Adds spec and basic solution for dropped document bug
1 parent 129f31d commit 4f7133b

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

lib/geo_combine/indexer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def index(docs)
4141
batch << [doc, path]
4242
else
4343
total_indexed += index_batch(batch)
44-
batch = []
44+
batch = [[doc, path]]
4545
end
4646
end
4747
total_indexed += index_batch(batch) unless batch.empty?

spec/lib/geo_combine/indexer_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ def self.connection; end
9696
)
9797
end
9898

99+
context 'when the number of docs is greater than batch size' do
100+
before do
101+
stub_const('ENV', 'SOLR_BATCH_SIZE' => 10)
102+
end
103+
104+
let(:docs) { (1..40).map { |n| [{ 'id' => n }, "path/to/record#{n}.json"] } }
105+
106+
it 'indexes the correct number of documents' do
107+
expect(indexer.index(docs)).to eq 40
108+
end
109+
end
110+
99111
it 'commits changes to solr after indexing' do
100112
indexer.index(docs)
101113
expect(solr).to have_received(:commit).once

0 commit comments

Comments
 (0)