Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GBL Harvester: default document_transformer should delete solr_bboxtype fields #101

Merged
merged 1 commit into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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