Skip to content

Commit

Permalink
GBL Harvester: add solr_bboxtype fields to document_transformer
Browse files Browse the repository at this point in the history
Fixes #100
  • Loading branch information
ewlarson committed Feb 24, 2021
1 parent c488971 commit 4952df5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions lib/geo_combine/geo_blacklight_harvester.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def document_transformer
document.delete('_version_')
document.delete('score')
document.delete('timestamp')
document.delete('solr_bboxtype__minX')
document.delete('solr_bboxtype__minY')
document.delete('solr_bboxtype__maxX')
document.delete('solr_bboxtype__maxY')
document
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/geo_combine/geo_blacklight_harvester_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
describe 'document tranformations' do
let(:docs) do
[
{ layer_slug_s: 'abc-123', _version_: '1', timestamp: '1999-12-31', score: 0.1 },
{ layer_slug_s: 'abc-123', _version_: '1', timestamp: '1999-12-31', score: 0.1, solr_bboxtype__minX: -87.324704, solr_bboxtype__minY: 40.233691, solr_bboxtype__maxX: -87.174404, solr_bboxtype__maxY: 40.310695 },
{ layer_slug_s: 'abc-321', dc_source_s: 'abc-123' }
]
end
Expand All @@ -68,7 +68,7 @@
expect(stub_solr_connection).to receive(:update).with(
hash_including(
data: [
{ layer_slug_s: 'abc-123', timestamp: '1999-12-31', score: 0.1 },
{ layer_slug_s: 'abc-123', timestamp: '1999-12-31', score: 0.1, solr_bboxtype__minX: -87.324704, solr_bboxtype__minY: 40.233691, solr_bboxtype__maxX: -87.174404, solr_bboxtype__maxY: 40.310695 },
{ layer_slug_s: 'abc-321', dc_source_s: 'abc-123' }
].to_json
)
Expand All @@ -79,7 +79,7 @@
end

context 'when no transformer is set' do
it 'removes the _version_, timestamp, and score fields' do
it 'removes the _version_, timestamp, score, and solr_bboxtype__* fields' do
expect(stub_solr_connection).to receive(:update).with(
hash_including(
data: [
Expand Down

0 comments on commit 4952df5

Please sign in to comment.