Skip to content

Commit

Permalink
Use the point_srpt field for indexing and map display
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Aug 1, 2016
1 parent 9a78245 commit dfb341a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class CatalogController < ApplicationController
config.view.gallery.partials = [:index_header, :index]
config.view.masonry.partials = [:index]
config.view.slideshow.partials = [:index]
config.view.maps.type = 'placename_coord'
config.view.maps.placename_coord_field = 'placename_coords_ssim'
config.view.maps.type = 'bbox'
config.view.maps.bbox_field = 'point_srpt'
config.view.embed.partials = [:osd_or_embed]
config.view.embed.if = false

Expand Down
8 changes: 4 additions & 4 deletions app/models/spotlight/dor/indexer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def solr_document(resource)
before_index :add_genre
before_index :add_geonames
before_index :add_location
before_index :add_point_bbox
before_index :add_point_srpt
before_index :add_series
end

Expand Down Expand Up @@ -82,10 +82,10 @@ def add_location(sdb, solr_doc)
solr_doc['location_ssi'] = sdb.smods_rec.physical_location_str
end

# add point_bbox solr field containing the point bounding box per
# add point_srpt solr field containing the point bounding box per
# MODS subject.cartographics.coordinates (via stanford-mods gem)
def add_point_bbox(sdb, solr_doc)
solr_doc['point_bbox'] = sdb.smods_rec.coordinates_as_envelope
def add_point_srpt(sdb, solr_doc)
solr_doc['point_srpt'] = sdb.smods_rec.coordinates_as_envelope
end

def add_series(sdb, solr_doc)
Expand Down
10 changes: 5 additions & 5 deletions spec/fixtures/sample_solr_docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@
"physical": [
"31 x 42 cm"
],
"point_bbox": [
"point_srpt": [
"ENVELOPE(51.0, -18.0, 37.0, -35.0)"
],
"pub_year_no_approx_isi": 1891,
Expand Down Expand Up @@ -888,7 +888,7 @@
"physical": [
"34 x 41 cm"
],
"point_bbox": [
"point_srpt": [
"ENVELOPE(34.0, 14.0, -21.0, -35.0)"
],
"pub_year_no_approx_isi": 1890,
Expand Down Expand Up @@ -1362,7 +1362,7 @@
"physical": [
"52 x 82 cm"
],
"point_bbox": [
"point_srpt": [
"ENVELOPE(41.0, 6.0, -5.0, -37.0)"
],
"pub_year_no_approx_isi": 1886,
Expand Down Expand Up @@ -1735,7 +1735,7 @@
"physical": [
"27 x 34 cm"
],
"point_bbox": [
"point_srpt": [
"ENVELOPE(51.0, -18.0, 37.0, -35.0)"
],
"pub_year_no_approx_isi": 1881,
Expand Down Expand Up @@ -1973,7 +1973,7 @@
"physical": [
"24 x 32 cm"
],
"point_bbox": [
"point_srpt": [
"ENVELOPE(51.0, -18.0, 37.0, -35.0)"
],
"pub_year_no_approx_isi": 1880,
Expand Down
14 changes: 7 additions & 7 deletions spec/models/spotlight/dor/indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,13 @@
end
end # add_location

describe '#add_point_bbox' do
describe '#add_point_srpt' do
before do
subject.send(:add_point_bbox, resource, solr_doc)
subject.send(:add_point_srpt, resource, solr_doc)
end

it 'without coordinates, point_bbox is blank' do
expect(solr_doc['point_bbox']).to be_blank
it 'without coordinates, point_srpt is blank' do
expect(solr_doc['point_srpt']).to be_blank
end

context 'with coordinates' do
Expand All @@ -519,11 +519,11 @@
EOF
end

it 'extracts the point_bbox' do
expect(solr_doc['point_bbox']).to eq(['ENVELOPE(-16.0, 28.0, 13.0, -15.0)'])
it 'extracts the point_srpt' do
expect(solr_doc['point_srpt']).to eq(['ENVELOPE(-16.0, 28.0, 13.0, -15.0)'])
end
end
end # add_point_bbox
end # add_point_srpt

describe '#add_series' do
before do
Expand Down

0 comments on commit dfb341a

Please sign in to comment.