geoblacklight 1.3.0 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 63a935be20a30e560a0653acdd2397fe9393d40f
4
- data.tar.gz: 325d07c535bf6b20a9a74f6f9d039dbd5257ce85
3
+ metadata.gz: d3613611043482bea42f602542263eb3e456cb0c
4
+ data.tar.gz: fa5d462b4d20b22ccc816f20e535e2dbda992668
5
5
  SHA512:
6
- metadata.gz: 5a8f2aca97d1458f5c8932aebe58e86ffbce1e330363448f34e25facf451b58eb713f0abc4071a1f5b39dcadeb0fb2e2690e6b2ee7feec05e052eea543e56b97
7
- data.tar.gz: 4a28c89f1d327a4cbf1c1cf1ddac47acf8e95d9730a6dab4bb65846904ed86e272b42a23f165ba2d5a05d5573ca42db0ef07d4ab2dd461f810ceafce55e46fd4
6
+ metadata.gz: b61a694e23f908f987682b1bef1d2f88ac3d034162343647d388c37c3a42f8405d2c9ca363218b08fc0467ce98adedf35c7a447e49e18c71540594279dd86bc4
7
+ data.tar.gz: 988a8942c3109c0244325bfee8db67be4a05a0e422eeb7c5ae2f0fa22d1fef5d4680fea982a084639237d60b352bd6efb7486a1b3056d5788c0811957fac9d6e
@@ -0,0 +1,17 @@
1
+ ### Descriptive summary
2
+
3
+ Include what version of GeoBlacklight related to this issue (1.3.0, master, etc.) if appropriate, and any relevant tracebacks if you're reporting a bug.
4
+
5
+ ### Expected behavior
6
+
7
+ ### Actual behavior
8
+
9
+ ### Steps to reproduce the behavior
10
+
11
+ 1. Do this
12
+ 1. Then do this...
13
+
14
+ ### Related work
15
+
16
+ Link to related tickets or prior related work here.
17
+
@@ -20,7 +20,7 @@
20
20
 
21
21
  var GeoBlacklight = L.Class.extend({
22
22
  statics: {
23
- __version__: '1.3.0',
23
+ __version__: '1.4.0',
24
24
 
25
25
  debounce: function(fn, delay) {
26
26
  var timeout = null;
@@ -11,16 +11,22 @@ Blacklight.onLoad(function() {
11
11
  $('[data-map="index"]').each(function() {
12
12
  var data = $(this).data(),
13
13
  opts = { baseUrl: data.catalogPath },
14
- geoblacklight, bbox;
14
+ geoblacklight;
15
+ var bbox = [[-180, -90], [180, 90]];
16
+
17
+ var parseableBbox = /(-?[0-9]{2})\s(-?[0-9]{3})\s(-?[0-9]{2})\s(-?[0-9]{3})/;
15
18
 
16
19
  if (typeof data.mapBbox === 'string') {
17
20
  bbox = L.bboxToBounds(data.mapBbox);
18
21
  } else {
19
22
  $('.document [data-bbox]').each(function() {
20
- if (typeof bbox === 'undefined') {
21
- bbox = L.bboxToBounds($(this).data().bbox);
22
- } else {
23
- bbox.extend(L.bboxToBounds($(this).data().bbox));
23
+ var currentBbox = $(this).data().bbox;
24
+ if (parseableBbox.test(currentBbox)) {
25
+ if (typeof bbox === 'undefined') {
26
+ bbox = L.bboxToBounds($(this).data().bbox);
27
+ } else {
28
+ bbox.extend(L.bboxToBounds($(this).data().bbox));
29
+ }
24
30
  }
25
31
  });
26
32
  }
@@ -60,7 +60,7 @@ module Geoblacklight
60
60
  end
61
61
 
62
62
  def bounding_box_as_wsen
63
- geom_field = fetch(Settings.FIELDS.GEOMETRY)
63
+ geom_field = fetch(Settings.FIELDS.GEOMETRY, '')
64
64
  exp = /^\s*ENVELOPE\(
65
65
  \s*([-\.\d]+)\s*,
66
66
  \s*([-\.\d]+)\s*,
@@ -68,13 +68,13 @@ module Geoblacklight
68
68
  \s*([-\.\d]+)\s*
69
69
  \)\s*$/x # uses 'x' option for free-spacing mode
70
70
  bbox_match = exp.match(geom_field)
71
- return s unless bbox_match # return as-is, not a WKT
71
+ return geom_field unless bbox_match # return as-is, not a WKT
72
72
  w, e, n, s = bbox_match.captures
73
73
  "#{w} #{s} #{e} #{n}"
74
74
  end
75
75
 
76
76
  def wxs_identifier
77
- fetch(Settings.FIELDS.WXS_IDENTIFIER)
77
+ fetch(Settings.FIELDS.WXS_IDENTIFIER, '')
78
78
  end
79
79
 
80
80
  def file_format
@@ -15,7 +15,7 @@ module Geoblacklight
15
15
  def add_spatial_params(solr_params)
16
16
  if blacklight_params[:bbox]
17
17
  solr_params[:bq] ||= []
18
- solr_params[:bq] = ["#{Settings.FIELDS.GEOMETRY}:\"IsWithin(#{envelope_bounds})\"^10"]
18
+ solr_params[:bq] << "#{Settings.FIELDS.GEOMETRY}:\"IsWithin(#{envelope_bounds})\"#{boost}"
19
19
  solr_params[:fq] ||= []
20
20
  solr_params[:fq] << "#{Settings.FIELDS.GEOMETRY}:\"Intersects(#{envelope_bounds})\""
21
21
  end
@@ -31,6 +31,12 @@ module Geoblacklight
31
31
  bounding_box.to_envelope
32
32
  end
33
33
 
34
+ ## Allow bq boost to be configured, default 10 for backwards compatibility
35
+ # @return [String]
36
+ def boost
37
+ "^#{Settings.BBOX_WITHIN_BOOST || '10'}"
38
+ end
39
+
34
40
  ##
35
41
  # Returns a Geoblacklight::BoundingBox built from the blacklight_params
36
42
  # @return [Geoblacklight::BoundingBox]
@@ -2,8 +2,10 @@
2
2
  <div class='home-search-area'>
3
3
  <%= content_tag :h2, t('geoblacklight.home.headline') %>
4
4
  <%= content_tag :h3, t('geoblacklight.home.search_heading') %>
5
- <div class='col-md-6 col-md-offset-3'>
6
- <%= render_search_form_no_navbar %>
5
+ <div class='row'>
6
+ <div class='col-md-6 col-md-offset-3'>
7
+ <%= render_search_form_no_navbar %>
8
+ </div>
7
9
  </div>
8
10
  </div>
9
11
  </div>
@@ -1,10 +1,12 @@
1
1
  <%= form_tag search_action_url, :method => :get, :class => 'search-query-form clearfix' do %>
2
2
  <%= render_hash_as_hidden_fields(search_state.params_for_search().except(:q, :search_field, :qt, :page, :utf8)) %>
3
3
 
4
- <% unless search_fields.empty? %>
4
+ <% if search_fields.length > 1 %>
5
5
  <label for="search_field" class="sr-only"><%= t('blacklight.search.form.search_field.label') %></label>
6
6
  <%= select_tag(:search_field, options_for_select(search_fields, h(params[:search_field])), :title => t('blacklight.search.form.search_field.title'), :class=>"search_field form-control") %>
7
7
  <span class="sr-only"><%= t('blacklight.search.form.search_field.post_label') %></span>
8
+ <% elsif search_fields.length == 1 %>
9
+ <%= hidden_field_tag :search_field, search_fields.first.last %>
8
10
  <% end %>
9
11
  <div class="input-group search-input-group">
10
12
  <label for="q" class="sr-only"><%= t('blacklight.search.form.search.label') %></label>
@@ -6,10 +6,6 @@ module Geoblacklight
6
6
 
7
7
  desc 'Install Geoblacklight'
8
8
 
9
- def add_solr_wrapper
10
- generate 'blacklight:solr5'
11
- end
12
-
13
9
  def mount_geoblacklight_engine
14
10
  route "mount Geoblacklight::Engine => 'geoblacklight'"
15
11
  end
@@ -145,7 +145,7 @@ class CatalogController < ApplicationController
145
145
  # solr request handler? The one set in config[:default_solr_parameters][:qt],
146
146
  # since we aren't specifying it otherwise.
147
147
 
148
- # config.add_search_field 'text', :label => 'All Fields'
148
+ config.add_search_field 'all_fields', :label => 'All Fields'
149
149
  # config.add_search_field 'dc_title_ti', :label => 'Title'
150
150
  # config.add_search_field 'dc_description_ti', :label => 'Description'
151
151
 
@@ -10,7 +10,10 @@ CARTO_ONECLICK_LINK: 'http://oneclick.cartodb.com/'
10
10
  # DEPRECATED Main Solr geometry field used for spatial search and bounding box. Should be type 'rpt'
11
11
  GEOMETRY_FIELD: 'solr_geom'
12
12
 
13
- #Solr field mappings
13
+ # The bq boost value for spatial search matches within a bounding box
14
+ BBOX_WITHIN_BOOST: '10'
15
+
16
+ # Solr field mappings
14
17
  FIELDS:
15
18
  :FILE_FORMAT: 'dc_format_s'
16
19
  :GEOMETRY: 'solr_geom'
@@ -1,3 +1,3 @@
1
1
  module Geoblacklight
2
- VERSION = '1.3.0'.freeze
2
+ VERSION = '1.4.0'.freeze
3
3
  end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'Empty search' do
4
+ before do
5
+ visit root_path
6
+ end
7
+ scenario 'Entering empty search returns results page' do
8
+ click_button 'search'
9
+ expect(page).to have_css '#documents'
10
+ end
11
+ end
@@ -14,7 +14,7 @@ feature 'Home page', js: true do # use js: true for tests which require js, but
14
14
  end
15
15
  scenario 'find by category' do
16
16
  expect(page).to have_css '.category-block', count: 4
17
- expect(page).to have_css '.home-facet-link', count: 33
17
+ expect(page).to have_css '.home-facet-link', count: 34
18
18
  expect(page).to have_css 'a.more_facets_link', count: 4
19
19
  click_link 'Elevation'
20
20
  expect(page).to have_css '.filterName', text: 'Subject'
@@ -0,0 +1,12 @@
1
+ require 'spec_helper'
2
+
3
+ feature 'Missing metadata', js: true do
4
+ scenario 'Yields error free results page for no spatial' do
5
+ visit search_catalog_path(q: 'ASTER Global Emissivity')
6
+ expect(page).to have_css('#map')
7
+ end
8
+ scenario 'Yields error free show page for no wxs_identifier or spatial' do
9
+ visit solr_document_path('aster-global-emissivity-dataset-1-kilometer-v003-ag1kmcad20')
10
+ expect(page).to have_css('#map')
11
+ end
12
+ end
@@ -0,0 +1,21 @@
1
+ {
2
+ "dc_identifier_s": "c0515c4e-97dc-4fff-82cb-f65144482631",
3
+ "dc_title_s": "ASTER Global Emissivity Dataset 1-kilometer V003 - AG1KM",
4
+ "dc_rights_s": "Public",
5
+ "layer_geom_type_s": "dataset",
6
+ "dct_provenance_s": "U.S. Geological Survey, Department of the Interior",
7
+ "dc_description_s": "The Advanced Spaceborne Thermal Emission and Reflection radiometer Global Emissivity Database (ASTER GED) was developed by the National Aeronautics and Space Administration's (NASA) Jet Propulsion Laboratory (JPL), California Institute of Technology. The North America portion of this collection was formerly called the North American ASTER Land Surface Emissivity Database (NAALSED) - a seasonal dataset consisting of mean summer (J-A-S) and winter (J-F-M) products. ASTER GED products are output on 1degree x 1 degree grids at 100-meter or 1-kilometer spatial resolution (nominal) and include the mean emissivity and standard deviation for all 5 ASTER thermal infrared bands, mean land surface temperature (LST) and standard deviation, a re-sampled ASTER GDEM (not included in the North America Winter products), land-water mask, mean Normalized Difference Vegetation Index (NDVI) and standard deviation, latitude, longitude, and observation count. Additional ASTER GED product information is available at https://lpdaac.usgs.gov/products/community_products_table. Product tiles are available in HDF and binary format and may be downloaded via HTTP by visiting the following data clients: NASA Reverb (http://reverb.echo.nasa.gov), LP DAAC Data Pool (http://e4ftl01.cr.usgs.gov/ASTT/), or EarthExplorer (http://earthexplorer.usgs.gov).",
8
+ "layer_slug_s": "aster-global-emissivity-dataset-1-kilometer-v003-ag1kmcad20",
9
+ "dc_subject_sm": [
10
+ "imagery",
11
+ "land surface temperature",
12
+ "u.s. geological survey (usgs)",
13
+ "earth observing system",
14
+ "land processes distributed active archive center (lpdaac)",
15
+ "aster",
16
+ "normalized difference vegetation index",
17
+ "terra",
18
+ "image map",
19
+ "emissivity"
20
+ ]
21
+ }
@@ -27,6 +27,18 @@ describe Geoblacklight::SpatialSearchBehavior do
27
27
  subject.with(params)
28
28
  expect(subject.add_spatial_params(solr_params)[:fq].to_s).to include('Intersects')
29
29
  end
30
+ it 'applies boost based on configured Settings.BBOX_WITHIN_BOOST' do
31
+ allow(Settings).to receive(:BBOX_WITHIN_BOOST).and_return 99
32
+ params = { bbox: '-180 -80 120 80' }
33
+ subject.with(params)
34
+ expect(subject.add_spatial_params(solr_params)[:bq].to_s).to include('^99')
35
+ end
36
+ it 'applies default boost of 10 when Settings.BBOX_WITHIN_BOOST not configured' do
37
+ allow(Settings).to receive(:BBOX_WITHIN_BOOST).and_return nil
38
+ params = { bbox: '-180 -80 120 80' }
39
+ subject.with(params)
40
+ expect(subject.add_spatial_params(solr_params)[:bq].to_s).to include('^10')
41
+ end
30
42
  end
31
43
  describe '#envelope_bounds' do
32
44
  it 'calls to_envelope on the bounding box' do
data/template.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  gem 'blacklight', '>= 6.3'
2
- gem 'geoblacklight', '>= 1.3'
2
+ gem 'geoblacklight', '>= 1.4'
3
3
 
4
4
  run 'bundle install'
5
5
 
6
6
  generate 'blacklight:install', '--devise'
7
- generate 'geoblacklight:install', '--solrwrapper', '-f'
7
+ generate 'geoblacklight:install', '-f'
8
8
 
9
9
  rake 'db:migrate'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoblacklight
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Graves
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-11-07 00:00:00.000000000 Z
14
+ date: 2017-04-11 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -271,6 +271,7 @@ extensions: []
271
271
  extra_rdoc_files: []
272
272
  files:
273
273
  - ".coveralls.yml"
274
+ - ".github/ISSUE_TEMPLATE.md"
274
275
  - ".gitignore"
275
276
  - ".gitmodules"
276
277
  - ".hound.yml"
@@ -442,6 +443,7 @@ files:
442
443
  - spec/features/configurable_basemap_spec.rb
443
444
  - spec/features/data_dictionary_download_spec.rb
444
445
  - spec/features/download_layer_spec.rb
446
+ - spec/features/empty_search_spec.rb
445
447
  - spec/features/esri_viewer_spec.rb
446
448
  - spec/features/exports_spec.rb
447
449
  - spec/features/home_page_spec.rb
@@ -452,6 +454,7 @@ files:
452
454
  - spec/features/layer_with_no_references_spec.rb
453
455
  - spec/features/linkified_attribute_table_spec.rb
454
456
  - spec/features/metadata_panel_spec.rb
457
+ - spec/features/missing_metadata_spec.rb
455
458
  - spec/features/relations_spec.rb
456
459
  - spec/features/saved_searches_spec.rb
457
460
  - spec/features/search_bar_spec.rb
@@ -472,6 +475,7 @@ files:
472
475
  - spec/fixtures/solr_documents/esri-tiled_map_layer.json
473
476
  - spec/fixtures/solr_documents/esri-wms-layer.json
474
477
  - spec/fixtures/solr_documents/harvard_raster.json
478
+ - spec/fixtures/solr_documents/no_spatial.json
475
479
  - spec/fixtures/solr_documents/public_direct_download.json
476
480
  - spec/fixtures/solr_documents/public_iiif_princeton.json
477
481
  - spec/fixtures/solr_documents/public_polygon_mit.json
@@ -541,7 +545,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
541
545
  version: 2.5.2
542
546
  requirements: []
543
547
  rubyforge_project:
544
- rubygems_version: 2.6.7
548
+ rubygems_version: 2.6.10
545
549
  signing_key:
546
550
  specification_version: 4
547
551
  summary: A discovery platform for geospatial holdings
@@ -555,6 +559,7 @@ test_files:
555
559
  - spec/features/configurable_basemap_spec.rb
556
560
  - spec/features/data_dictionary_download_spec.rb
557
561
  - spec/features/download_layer_spec.rb
562
+ - spec/features/empty_search_spec.rb
558
563
  - spec/features/esri_viewer_spec.rb
559
564
  - spec/features/exports_spec.rb
560
565
  - spec/features/home_page_spec.rb
@@ -565,6 +570,7 @@ test_files:
565
570
  - spec/features/layer_with_no_references_spec.rb
566
571
  - spec/features/linkified_attribute_table_spec.rb
567
572
  - spec/features/metadata_panel_spec.rb
573
+ - spec/features/missing_metadata_spec.rb
568
574
  - spec/features/relations_spec.rb
569
575
  - spec/features/saved_searches_spec.rb
570
576
  - spec/features/search_bar_spec.rb
@@ -585,6 +591,7 @@ test_files:
585
591
  - spec/fixtures/solr_documents/esri-tiled_map_layer.json
586
592
  - spec/fixtures/solr_documents/esri-wms-layer.json
587
593
  - spec/fixtures/solr_documents/harvard_raster.json
594
+ - spec/fixtures/solr_documents/no_spatial.json
588
595
  - spec/fixtures/solr_documents/public_direct_download.json
589
596
  - spec/fixtures/solr_documents/public_iiif_princeton.json
590
597
  - spec/fixtures/solr_documents/public_polygon_mit.json