geoblacklight_admin 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +24 -11
- data/Rakefile +83 -47
- data/app/assets/javascripts/geoblacklight_admin/chosen.js +1 -0
- data/app/assets/stylesheets/geoblacklight_admin/_core.scss +24 -0
- data/app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss +0 -5
- data/app/assets/stylesheets/geoblacklight_admin/modules/_tables.scss +1 -1
- data/app/controllers/admin/admin_controller.rb +16 -0
- data/app/controllers/admin/advanced_search_controller.rb +7 -1
- data/app/controllers/admin/assets_controller.rb +47 -32
- data/app/controllers/admin/bookmarks_controller.rb +17 -5
- data/app/controllers/admin/bulk_actions_controller.rb +32 -1
- data/app/controllers/admin/document_accesses_controller.rb +38 -0
- data/app/controllers/admin/document_assets_controller.rb +47 -89
- data/app/controllers/admin/document_distributions_controller.rb +172 -0
- data/app/controllers/admin/documents_controller.rb +43 -57
- data/app/controllers/admin/elements_controller.rb +24 -0
- data/app/controllers/admin/form_elements_controller.rb +33 -0
- data/app/controllers/admin/ids_controller.rb +6 -0
- data/app/controllers/admin/import_documents_controller.rb +11 -1
- data/app/controllers/admin/imports_controller.rb +34 -4
- data/app/controllers/admin/mappings_controller.rb +15 -0
- data/app/controllers/admin/notifications_controller.rb +27 -0
- data/app/controllers/admin/reference_types_controller.rb +106 -0
- data/app/controllers/admin/search_controller.rb +7 -0
- data/app/controllers/admin/users_controller.rb +10 -0
- data/app/helpers/asset_helper.rb +6 -0
- data/app/helpers/bulk_actions_helper.rb +10 -1
- data/app/helpers/document_helper.rb +36 -0
- data/app/helpers/geoblacklight_admin_helper.rb +88 -8
- data/app/helpers/mappings_helper.rb +26 -0
- data/app/indexers/document_indexer.rb +22 -2
- data/app/javascript/channels/consumer.js +6 -0
- data/app/javascript/channels/export_channel.js +30 -0
- data/app/javascript/channels/index.js +3 -0
- data/app/javascript/controllers/results_controller.js +14 -0
- data/app/javascript/index.js +8 -2
- data/app/jobs/bulk_action_revert_document_job.rb +4 -12
- data/app/jobs/bulk_action_run_document_job.rb +2 -10
- data/app/jobs/export_job.rb +35 -8
- data/app/jobs/geoblacklight_admin/delete_thumbnail_job.rb +19 -0
- data/app/jobs/geoblacklight_admin/remove_parent_dct_references_uri_job.rb +16 -0
- data/app/jobs/geoblacklight_admin/set_parent_dct_references_uri_job.rb +17 -0
- data/app/jobs/geoblacklight_admin/store_image_job.rb +22 -0
- data/app/jobs/import_document_job.rb +1 -4
- data/app/jobs/import_run_job.rb +1 -1
- data/app/models/admin/bookmark.rb +1 -1
- data/app/models/asset.rb +20 -0
- data/app/models/bulk_action.rb +2 -1
- data/app/models/bulk_actions/change_publication_state.rb +0 -25
- data/app/models/bulk_actions/delete_thumbnails.rb +6 -0
- data/app/models/bulk_actions/draft_document.rb +6 -0
- data/app/models/bulk_actions/harvest_thumbnails.rb +6 -0
- data/app/models/bulk_actions/publish_document.rb +6 -0
- data/app/models/bulk_actions/unpublish_document.rb +6 -0
- data/app/models/document/geom_validator.rb +8 -0
- data/app/models/document/reference.rb +65 -65
- data/app/models/document.rb +129 -72
- data/app/models/document_distribution.rb +145 -0
- data/app/models/element.rb +2 -0
- data/app/models/geoblacklight_admin/schema.rb +10 -2
- data/app/models/import/csv_duplicates_validator.rb +2 -0
- data/app/models/import/csv_header_validator.rb +3 -1
- data/app/models/import_btaa_aardvark.rb +2 -2
- data/app/models/import_document_state_machine.rb +1 -0
- data/app/models/import_gblv1.rb +2 -2
- data/app/models/reference_type.rb +40 -0
- data/app/models/user.rb +4 -2
- data/app/services/export_csv_document_distributions_service.rb +61 -0
- data/app/services/geoblacklight_admin/image_service/iiif_manifest.rb +39 -43
- data/app/services/geoblacklight_admin/image_service/tms.rb +0 -8
- data/app/services/geoblacklight_admin/image_service.rb +1 -1
- data/app/services/geoblacklight_admin/item_viewer.rb +4 -4
- data/app/views/admin/bookmarks/index.html.erb +19 -14
- data/app/views/admin/bulk_actions/show.html.erb +1 -1
- data/app/views/admin/document_accesses/import.html.erb +6 -2
- data/app/views/admin/document_assets/_assets_table.html.erb +49 -0
- data/app/views/admin/document_assets/_form.html.erb +2 -3
- data/app/views/admin/document_assets/index.html.erb +1 -47
- data/app/views/admin/document_distributions/_document_distribution.html.erb +39 -0
- data/app/views/admin/document_distributions/_document_distribution.json.jbuilder +2 -0
- data/app/views/admin/document_distributions/_form.html.erb +34 -0
- data/app/views/admin/document_distributions/destroy_all.html.erb +82 -0
- data/app/views/admin/document_distributions/edit.html.erb +12 -0
- data/app/views/admin/document_distributions/import.html.erb +80 -0
- data/app/views/admin/document_distributions/index.html.erb +143 -0
- data/app/views/admin/document_distributions/index.json.jbuilder +1 -0
- data/app/views/admin/document_distributions/new.html.erb +11 -0
- data/app/views/admin/document_distributions/show.html.erb +10 -0
- data/app/views/admin/document_distributions/show.json.jbuilder +1 -0
- data/app/views/admin/documents/_document.html.erb +1 -3
- data/app/views/admin/documents/_form.html.erb +2 -4
- data/app/views/admin/documents/_form_control.html.erb +5 -2
- data/app/views/admin/documents/_form_nav.html.erb +14 -5
- data/app/views/admin/documents/_form_nav_kithe.html.erb +4 -1
- data/app/views/admin/documents/_json_aardvark.jbuilder +1 -1
- data/app/views/admin/documents/_json_gbl_v1.jbuilder +1 -1
- data/app/views/admin/documents/_result_selected_options.html.erb +5 -2
- data/app/views/admin/documents/admin.html.erb +5 -5
- data/app/views/admin/documents/features/_document_references.html.erb +23 -0
- data/app/views/admin/documents/features/_multiple_download_links.html.erb +29 -26
- data/app/views/admin/ids/fetch.json.jbuilder +0 -2
- data/app/views/admin/ids/index.json.jbuilder +0 -2
- data/app/views/admin/imports/_form.html.erb +1 -1
- data/app/views/admin/imports/show.html.erb +1 -1
- data/app/views/admin/layouts/application.html.erb +4 -2
- data/app/views/admin/mappings/index.html.erb +1 -1
- data/app/views/admin/notifications/_notification.html.haml +29 -28
- data/app/views/admin/reference_types/_form.html.erb +25 -0
- data/app/views/admin/reference_types/_reference_type.html.erb +52 -0
- data/app/views/admin/reference_types/_reference_type.json.jbuilder +2 -0
- data/app/views/admin/reference_types/edit.html.erb +12 -0
- data/app/views/admin/reference_types/index.html.erb +52 -0
- data/app/views/admin/reference_types/index.json.jbuilder +1 -0
- data/app/views/admin/reference_types/new.html.erb +11 -0
- data/app/views/admin/reference_types/show.html.erb +3 -0
- data/app/views/admin/reference_types/show.json.jbuilder +1 -0
- data/app/views/admin/shared/_footer.html.erb +5 -2
- data/app/views/admin/shared/_js_behaviors.html.erb +2 -3
- data/app/views/admin/shared/_navbar.html.erb +9 -2
- data/app/views/admin/users/index.html.erb +0 -1
- data/app/views/catalog/_show_gbl_admin.html.erb +1 -1
- data/config/initializers/defaults.yml +310 -0
- data/config/initializers/rails_config.rb +8 -0
- data/config/locales/documents.en.yml +14 -0
- data/config/routes.rb +30 -5
- data/db/import_references_schema_support.numbers +0 -0
- data/db/migrate/20230316183001_add_geoblacklight_admin_gem.rb +0 -12
- data/db/migrate/20241009200524_create_admin_reference_types.rb +13 -0
- data/db/migrate/20241010161420_create_document_references.rb +14 -0
- data/db/migrate/20241120238823_rename_references_to_distributions.rb +5 -0
- data/db/seeds.rb +5 -0
- data/db/seeds_elements.csv +1 -1
- data/db/seeds_elements.numbers +0 -0
- data/db/seeds_reference_types.csv +29 -0
- data/db/seeds_reference_types.numbers +0 -0
- data/db/structure.sql +1 -38
- data/lib/compose.yml +31 -0
- data/lib/generators/geoblacklight_admin/config_generator.rb +53 -12
- data/lib/generators/geoblacklight_admin/install_generator.rb +8 -0
- data/lib/generators/geoblacklight_admin/templates/btaa_sample_records.csv +5 -0
- data/lib/generators/geoblacklight_admin/templates/config/database.yml +1 -1
- data/lib/generators/geoblacklight_admin/templates/config/initializers/devise.rb +0 -2
- data/lib/generators/geoblacklight_admin/templates/config/initializers/mime_types.rb +1 -0
- data/lib/generators/geoblacklight_admin/templates/demo-app/Dockerfile +31 -0
- data/lib/generators/geoblacklight_admin/templates/demo-app/compose.yml +42 -0
- data/lib/generators/geoblacklight_admin/templates/demo-app/start-server.sh +21 -0
- data/lib/geoblacklight_admin/engine.rb +4 -0
- data/lib/geoblacklight_admin/rake_task.rb +2 -0
- data/lib/geoblacklight_admin/tasks/distributions.rake +69 -0
- data/lib/geoblacklight_admin/tasks/images.rake +1 -0
- data/lib/geoblacklight_admin/tasks/solr.rake +31 -0
- data/lib/geoblacklight_admin/version.rb +1 -1
- data/lib/geoblacklight_admin.rb +4 -0
- metadata +137 -53
- data/app/helpers/import_documents_helper.rb +0 -5
- data/app/javascript/entrypoints/engine.js +0 -8
- data/config/locales/devise_invitable.en.yml +0 -31
- data/lib/generators/geoblacklight_admin/templates/devise/invitations/edit.html.erb +0 -15
- data/lib/generators/geoblacklight_admin/templates/devise/invitations/new.html.erb +0 -15
- data/lib/generators/geoblacklight_admin/templates/devise/mailer/invitation_instructions.html.erb +0 -11
- data/lib/generators/geoblacklight_admin/templates/devise/mailer/invitation_instructions.text.erb +0 -11
@@ -364,20 +364,8 @@ class AddGeoblacklightAdminGem < ActiveRecord::Migration[6.1]
|
|
364
364
|
t.datetime 'remember_created_at'
|
365
365
|
t.datetime 'created_at', precision: 6, null: false
|
366
366
|
t.datetime 'updated_at', precision: 6, null: false
|
367
|
-
t.string 'invitation_token'
|
368
|
-
t.datetime 'invitation_created_at'
|
369
|
-
t.datetime 'invitation_sent_at'
|
370
|
-
t.datetime 'invitation_accepted_at'
|
371
|
-
t.integer 'invitation_limit'
|
372
|
-
t.string 'invited_by_type'
|
373
|
-
t.bigint 'invited_by_id'
|
374
|
-
t.integer 'invitations_count', default: 0
|
375
367
|
t.boolean 'admin', default: false, null: false
|
376
368
|
t.index ['email'], name: 'index_users_on_email', unique: true
|
377
|
-
t.index ['invitation_token'], name: 'index_users_on_invitation_token', unique: true
|
378
|
-
t.index ['invitations_count'], name: 'index_users_on_invitations_count'
|
379
|
-
t.index ['invited_by_id'], name: 'index_users_on_invited_by_id'
|
380
|
-
t.index %w[invited_by_type invited_by_id], name: 'index_users_on_invited_by_type_and_invited_by_id'
|
381
369
|
t.index ['reset_password_token'], name: 'index_users_on_reset_password_token', unique: true
|
382
370
|
end
|
383
371
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateAdminReferenceTypes < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :reference_types do |t|
|
4
|
+
t.string :name # short name, ex: "cog"
|
5
|
+
t.string :reference_type # human-readable name, ex: "Cloud Optimized GeoTIFF (COG)"
|
6
|
+
t.string :reference_uri # key name, ex: "https://github.com/cogeotiff/cog-spec"
|
7
|
+
t.boolean :label, default: false # optional download label
|
8
|
+
t.text :note # optional note
|
9
|
+
t.integer :position # position for sorting
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateDocumentReferences < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :document_references do |t|
|
4
|
+
t.string :friendlier_id, null: false
|
5
|
+
t.references :reference_type, null: false, foreign_key: true
|
6
|
+
t.string :url
|
7
|
+
t.string :label
|
8
|
+
t.integer :position
|
9
|
+
t.timestamps
|
10
|
+
|
11
|
+
t.index [:friendlier_id, :reference_type_id, :url], unique: true
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/db/seeds.rb
CHANGED
@@ -23,5 +23,10 @@ CSV.foreach(File.expand_path('seeds_form_elements.csv', File.dirname(__FILE__)),
|
|
23
23
|
FormElement.create!(row.to_hash)
|
24
24
|
end
|
25
25
|
|
26
|
+
# Reference Types
|
27
|
+
CSV.foreach(File.expand_path('seeds_reference_types.csv', File.dirname(__FILE__)), headers: true) do |row|
|
28
|
+
ReferenceType.create!(row.to_hash)
|
29
|
+
end
|
30
|
+
|
26
31
|
# Users
|
27
32
|
User.create(email: 'admin@geoblacklight.org', password: '123456', password_confirmation: '123456', admin: true)
|
data/db/seeds_elements.csv
CHANGED
@@ -37,7 +37,7 @@ License,dct_license_sm,https://opengeometadata.org/ogm-aardvark/#license,string,
|
|
37
37
|
Access Rights,dct_accessRights_s,https://opengeometadata.org/ogm-aardvark/#access-rights,string,TRUE,FALSE,TRUE,,,access-rights1|access-rights2,access_rights,,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,presence,36
|
38
38
|
Format,dct_format_s,https://opengeometadata.org/ogm-aardvark/#format,string,FALSE,FALSE,TRUE,,,format,formats,autocomplete,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,,37
|
39
39
|
File Size,gbl_fileSize_s,https://opengeometadata.org/ogm-aardvark/#file-size,string,FALSE,FALSE,TRUE,,,60mb,,,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,,38
|
40
|
-
Reference,dct_references_s,https://opengeometadata.org/ogm-aardvark/#references,text,FALSE,TRUE,TRUE,,URIs and Values,,reference_values,,,FALSE,TRUE,FALSE,build_dct_references,TRUE,
|
40
|
+
Reference,dct_references_s,https://opengeometadata.org/ogm-aardvark/#references,text,FALSE,TRUE,TRUE,,URIs and Values,,reference_values,,,FALSE,TRUE,FALSE,build_dct_references,TRUE,distributions_json,TRUE,distributions_json,,39
|
41
41
|
WxS Identifier,gbl_wxsIdentifier_s,https://opengeometadata.org/ogm-aardvark/#wxs-identifier,string,FALSE,FALSE,TRUE,,,wxs-identifier,,,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,,40
|
42
42
|
B1G Image URL,b1g_image_ss,https://geobtaa.github.io/metadata/b1g-custom-elements/#image,string,FALSE,FALSE,TRUE,,,image,,,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,,41
|
43
43
|
ID,geomg_id_s,https://opengeometadata.org/ogm-aardvark/#id,string,TRUE,FALSE,TRUE,,,slug,,disable_if_persisted,,FALSE,TRUE,FALSE,,TRUE,,TRUE,,presence,42
|
data/db/seeds_elements.numbers
CHANGED
Binary file
|
@@ -0,0 +1,29 @@
|
|
1
|
+
name,reference_type,reference_uri,label,note,position
|
2
|
+
arcgis_dynamic_map_layer,ArcGIS DynamicMapLayer,urn:x-esri:serviceType:ArcGIS#DynamicMapLayer,FALSE,-,1
|
3
|
+
arcgis_feature_layer,ArcGIS FeatureLayer,urn:x-esri:serviceType:ArcGIS#FeatureLayer,FALSE,-,2
|
4
|
+
arcgis_image_map_layer,ArcGIS ImageMapLayer,urn:x-esri:serviceType:ArcGIS#ImageMapLayer,FALSE,-,3
|
5
|
+
arcgis_tiled_map_layer,ArcGIS TiledMapLayer,urn:x-esri:serviceType:ArcGIS#TiledMapLayer,FALSE,-,4
|
6
|
+
cog,Cloud Optimized GeoTIFF (COG),https://github.com/cogeotiff/cog-spec,FALSE,-,5
|
7
|
+
documentation_download,Data Dictionary / documentation,http://lccn.loc.gov/sh85035852,FALSE,Functions as a link to download documentation (not a viewer),6
|
8
|
+
documentation_external,Documentation (External),http://schema.org/url,FALSE,-,7
|
9
|
+
download,Download,http://schema.org/downloadUrl,TRUE,Link to download file (for multiple files see the multiple downloads guidelines),8
|
10
|
+
geo_json,GeoJSON,http://geojson.org/geojson-spec.html,FALSE,-,9
|
11
|
+
full_layer_description,Full layer description,http://schema.org/url,FALSE,To view further descriptive information about the layer or a link to its landing page,10
|
12
|
+
iiif_image,International Image Interoperability Framework (IIIF) Image API,http://iiif.io/api/image,FALSE,Load the image viewer using Leaflet-IIIF,11
|
13
|
+
iiif_manifest,International Image Interoperability Framework (IIIF) Presentation API Manifest,http://iiif.io/api/presentation#manifest,FALSE,View the IIIF manifest - uses the Clover viewer by default https://samvera-labs.github.io/clover-iiif/docs,12
|
14
|
+
image,Image file,http://schema.org/image,TRUE,-,13
|
15
|
+
metadata_fgdc,Metadata in FGDC,http://www.opengis.net/cat/csw/csdgm,FALSE,Provides an HTML view of an XML file in the FGDC standard,14
|
16
|
+
metadata_html,Metadata in HTML,http://www.w3.org/1999/xhtml,FALSE,View structured metadata in any standard expressed as HTML,15
|
17
|
+
metadata_iso,Metadata in ISO 19139,http://www.isotc211.org/schemas/2005/gmd/,FALSE,Provides an HTML view of an XML file in the ISO 19139 standard,16
|
18
|
+
metadata_mods,Metadata in MODS,http://www.loc.gov/mods/v3,FALSE,Provides a raw XML view of metadata in the MODS format,17
|
19
|
+
oembed,oEmbed,https://oembed.com,FALSE,-,18
|
20
|
+
open_index_map,OpenIndexMap,https://openindexmaps.org,FALSE,Provides an interactive preview of a GeoJSON file formatted as an OpenIndexMap,19
|
21
|
+
pmtiles,PMTiles,https://github.com/protomaps/PMTiles,FALSE,-,20
|
22
|
+
thumbnail,Thumbnail file,http://schema.org/thumbnailUrl,TRUE,-,21
|
23
|
+
tile_map_service,Tile Mapping Service (TMS),https://wiki.osgeo.org/wiki/Tile_Map_Service_Specification,FALSE,-,22
|
24
|
+
tile_json,TileJSON,https://github.com/mapbox/tilejson-spec,FALSE,-,23
|
25
|
+
wcs,Web Coverage Service (WCS),http://www.opengis.net/def/serviceType/ogc/wcs,FALSE,-,24
|
26
|
+
wfs,Web Feature Service (WFS),http://www.opengis.net/def/serviceType/ogc/wfs,FALSE,"Provides a to download generated vector datasets (GeoJSON, shapefile)",25
|
27
|
+
wmts,Web Mapping Service (WMS),http://www.opengis.net/def/serviceType/ogc/wms,FALSE,Provides a service to visually preview a layer and inspect its features,26
|
28
|
+
wms,WMTS,http://www.opengis.net/def/serviceType/ogc/wmts,FALSE,-,27
|
29
|
+
xyz_tiles,XYZ tiles,https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames,FALSE,Link to an XYZ tile server,28
|
Binary file
|
data/db/structure.sql
CHANGED
@@ -349,15 +349,7 @@ CREATE TABLE public.users (
|
|
349
349
|
reset_password_sent_at timestamp without time zone,
|
350
350
|
remember_created_at timestamp without time zone,
|
351
351
|
created_at timestamp(6) without time zone NOT NULL,
|
352
|
-
updated_at timestamp(6) without time zone NOT NULL
|
353
|
-
invitation_token character varying,
|
354
|
-
invitation_created_at timestamp without time zone,
|
355
|
-
invitation_sent_at timestamp without time zone,
|
356
|
-
invitation_accepted_at timestamp without time zone,
|
357
|
-
invitation_limit integer,
|
358
|
-
invited_by_type character varying,
|
359
|
-
invited_by_id bigint,
|
360
|
-
invitations_count integer DEFAULT 0
|
352
|
+
updated_at timestamp(6) without time zone NOT NULL
|
361
353
|
);
|
362
354
|
|
363
355
|
|
@@ -670,35 +662,6 @@ CREATE INDEX index_mappings_on_import_id ON public.mappings USING btree (import_
|
|
670
662
|
|
671
663
|
CREATE UNIQUE INDEX index_users_on_email ON public.users USING btree (email);
|
672
664
|
|
673
|
-
|
674
|
-
--
|
675
|
-
-- Name: index_users_on_invitation_token; Type: INDEX; Schema: public; Owner: -
|
676
|
-
--
|
677
|
-
|
678
|
-
CREATE UNIQUE INDEX index_users_on_invitation_token ON public.users USING btree (invitation_token);
|
679
|
-
|
680
|
-
|
681
|
-
--
|
682
|
-
-- Name: index_users_on_invitations_count; Type: INDEX; Schema: public; Owner: -
|
683
|
-
--
|
684
|
-
|
685
|
-
CREATE INDEX index_users_on_invitations_count ON public.users USING btree (invitations_count);
|
686
|
-
|
687
|
-
|
688
|
-
--
|
689
|
-
-- Name: index_users_on_invited_by_id; Type: INDEX; Schema: public; Owner: -
|
690
|
-
--
|
691
|
-
|
692
|
-
CREATE INDEX index_users_on_invited_by_id ON public.users USING btree (invited_by_id);
|
693
|
-
|
694
|
-
|
695
|
-
--
|
696
|
-
-- Name: index_users_on_invited_by_type_and_invited_by_id; Type: INDEX; Schema: public; Owner: -
|
697
|
-
--
|
698
|
-
|
699
|
-
CREATE INDEX index_users_on_invited_by_type_and_invited_by_id ON public.users USING btree (invited_by_type, invited_by_id);
|
700
|
-
|
701
|
-
|
702
665
|
--
|
703
666
|
-- Name: index_users_on_reset_password_token; Type: INDEX; Schema: public; Owner: -
|
704
667
|
--
|
data/lib/compose.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
services:
|
2
|
+
solr:
|
3
|
+
image: solr:9.6.1
|
4
|
+
volumes:
|
5
|
+
- $PWD/solr/conf:/opt/solr/conf
|
6
|
+
ports:
|
7
|
+
- 8983:8983
|
8
|
+
entrypoint:
|
9
|
+
- docker-entrypoint.sh
|
10
|
+
- solr-precreate
|
11
|
+
- blacklight-core
|
12
|
+
- /opt/solr/conf
|
13
|
+
- "-Xms256m"
|
14
|
+
- "-Xmx512m"
|
15
|
+
|
16
|
+
postgres:
|
17
|
+
image: postgres:latest
|
18
|
+
env:
|
19
|
+
POSTGRES_HOST: 127.0.0.1
|
20
|
+
POSTGRES_PORT: 5432
|
21
|
+
POSTGRES_DB: geoblacklight_development
|
22
|
+
POSTGRES_USER: postgres
|
23
|
+
POSTGRES_PASSWORD: postgres
|
24
|
+
ports:
|
25
|
+
- 5432:5432
|
26
|
+
# Set health checks to wait until postgres has started
|
27
|
+
options:
|
28
|
+
--health-cmd pg_isready
|
29
|
+
--health-interval 10s
|
30
|
+
--health-timeout 5s
|
31
|
+
--health-retries 5
|
@@ -13,7 +13,7 @@ module GeoblacklightAdmin
|
|
13
13
|
3. Copies sidekiq.yml connection to host config
|
14
14
|
5. Copies .env.development and .env.test to host
|
15
15
|
4. Copies settings.yml to host config
|
16
|
-
|
16
|
+
5. Copies .solr_wrapper.yml to host config
|
17
17
|
6. Copies JSON Schema to host
|
18
18
|
7. Copies solr/* to host
|
19
19
|
8. Sets Routes
|
@@ -56,6 +56,10 @@ module GeoblacklightAdmin
|
|
56
56
|
copy_file "config/sidekiq.yml", "config/sidekiq.yml", force: true
|
57
57
|
end
|
58
58
|
|
59
|
+
def create_solr_wrapper_yml
|
60
|
+
copy_file ".solr_wrapper.yml", ".solr_wrapper.yml", force: true
|
61
|
+
end
|
62
|
+
|
59
63
|
def create_dotenv
|
60
64
|
copy_file ".env.development.example", ".env.development"
|
61
65
|
copy_file ".env.development.example", ".env.test"
|
@@ -65,10 +69,6 @@ module GeoblacklightAdmin
|
|
65
69
|
copy_file "config/settings.yml", "config/settings.yml", force: true
|
66
70
|
end
|
67
71
|
|
68
|
-
def create_solr_yml
|
69
|
-
copy_file ".solr_wrapper.yml", ".solr_wrapper.yml", force: true
|
70
|
-
end
|
71
|
-
|
72
72
|
def copy_json_schema
|
73
73
|
copy_file "config/geomg_aardvark_schema.json", "config/geomg_aardvark_schema.json"
|
74
74
|
end
|
@@ -89,7 +89,7 @@ module GeoblacklightAdmin
|
|
89
89
|
end
|
90
90
|
|
91
91
|
# Users
|
92
|
-
devise_for :users,
|
92
|
+
devise_for :users, skip: [:registrations]
|
93
93
|
as :user do
|
94
94
|
get "/sign_in" => "devise/sessions#new" # custom path to login/sign_in
|
95
95
|
get "/sign_up" => "devise/registrations#new", :as => "new_user_registration" # custom path to sign_up/registration
|
@@ -143,6 +143,11 @@ module GeoblacklightAdmin
|
|
143
143
|
resources :form_control, path: :form_elements, controller: :form_elements
|
144
144
|
resources :form_feature, path: :form_elements, controller: :form_elements
|
145
145
|
|
146
|
+
# Reference Types
|
147
|
+
resources :reference_types do
|
148
|
+
post :sort, on: :collection
|
149
|
+
end
|
150
|
+
|
146
151
|
# Notifications
|
147
152
|
resources :notifications do
|
148
153
|
put "batch", on: :collection
|
@@ -174,6 +179,10 @@ module GeoblacklightAdmin
|
|
174
179
|
get "admin"
|
175
180
|
get "versions"
|
176
181
|
|
182
|
+
collection do
|
183
|
+
get "fetch"
|
184
|
+
end
|
185
|
+
|
177
186
|
# DocumentAccesses
|
178
187
|
resources :document_accesses, path: "access" do
|
179
188
|
collection do
|
@@ -185,6 +194,17 @@ module GeoblacklightAdmin
|
|
185
194
|
end
|
186
195
|
end
|
187
196
|
|
197
|
+
# Document Assets
|
198
|
+
resources :document_assets, path: "assets" do
|
199
|
+
collection do
|
200
|
+
get "display_attach_form"
|
201
|
+
post "attach_files"
|
202
|
+
|
203
|
+
get "destroy_all"
|
204
|
+
post "destroy_all"
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
188
208
|
# DocumentDownloads
|
189
209
|
resources :document_downloads, path: "downloads" do
|
190
210
|
collection do
|
@@ -196,20 +216,19 @@ module GeoblacklightAdmin
|
|
196
216
|
end
|
197
217
|
end
|
198
218
|
|
199
|
-
# Document
|
200
|
-
resources :
|
219
|
+
# Document References
|
220
|
+
resources :document_distributions, path: "distributions" do
|
201
221
|
collection do
|
202
222
|
get "display_attach_form"
|
203
223
|
post "attach_files"
|
204
224
|
|
225
|
+
get "import"
|
226
|
+
post "import"
|
227
|
+
|
205
228
|
get "destroy_all"
|
206
229
|
post "destroy_all"
|
207
230
|
end
|
208
231
|
end
|
209
|
-
|
210
|
-
collection do
|
211
|
-
get "fetch"
|
212
|
-
end
|
213
232
|
end
|
214
233
|
|
215
234
|
# Document Accesses
|
@@ -234,6 +253,17 @@ module GeoblacklightAdmin
|
|
234
253
|
end
|
235
254
|
end
|
236
255
|
|
256
|
+
# Document Distributions
|
257
|
+
resources :document_distributions, path: "distributions" do
|
258
|
+
collection do
|
259
|
+
get "import"
|
260
|
+
post "import"
|
261
|
+
|
262
|
+
get "destroy_all"
|
263
|
+
post "destroy_all"
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
237
267
|
# Document Assets
|
238
268
|
resources :document_assets, path: "assets" do
|
239
269
|
collection do
|
@@ -374,6 +404,12 @@ module GeoblacklightAdmin
|
|
374
404
|
end
|
375
405
|
end
|
376
406
|
|
407
|
+
def add_application_config_for_psych_time_with_zone
|
408
|
+
inject_into_file "config/application.rb", after: "config.generators.system_tests = nil" do
|
409
|
+
"\n config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone]"
|
410
|
+
end
|
411
|
+
end
|
412
|
+
|
377
413
|
def add_vite_rails_config
|
378
414
|
copy_file "base.html.erb", "app/views/layouts/blacklight/base.html.erb", force: true
|
379
415
|
copy_file "vite.config.ts", "vite.config.ts", force: true
|
@@ -381,6 +417,11 @@ module GeoblacklightAdmin
|
|
381
417
|
copy_file "frontend/entrypoints/application.js", "app/javascript/entrypoints/application.js", force: true
|
382
418
|
end
|
383
419
|
|
420
|
+
# Add test fixture files - Necessary for import background job tests
|
421
|
+
def add_test_fixture_files
|
422
|
+
copy_file "btaa_sample_records.csv", "test/fixtures/files/btaa_sample_records.csv", force: true
|
423
|
+
end
|
424
|
+
|
384
425
|
# Run bundle with vite install
|
385
426
|
def bundle_install
|
386
427
|
Bundler.with_clean_env do
|
@@ -48,5 +48,13 @@ module GeoblacklightAdmin
|
|
48
48
|
run "yarn add @geoblacklight/frontend@^4.4.6"
|
49
49
|
run "yarn install"
|
50
50
|
end
|
51
|
+
|
52
|
+
def add_rsolr_gem
|
53
|
+
gem "rsolr", ">= 1.0", "< 3"
|
54
|
+
end
|
55
|
+
|
56
|
+
def docker_compose
|
57
|
+
copy_file "../../../../compose.yml", "compose.yml"
|
58
|
+
end
|
51
59
|
end
|
52
60
|
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
Title,Alternative Title,Description,Language,Creator,Creator ID,Publisher,Provider,Resource Class,Resource Type,Subject,Theme,Keyword,Temporal Coverage,Date Issued,Date Range,Spatial Coverage,Bounding Box,Geometry,GeoNames,Relation,Member Of,Is Part Of,Source,Version,Replaces,Is Replaced By,Format,File Size,WxS Identifier,Georeferenced,Documentation,Download,FeatureServer,FGDC,Harvard Download,HTML,IIIF,ImageServer,Information,ISO19139,Manifest,MapServer,MODS,oEmbed,Index Map,TileServer,WCS,WFS,WMS,Image,ID,Identifier,Code,Rights,Rights Holder,License,Access Rights,Accrual Method,Accrual Periodicity,Date Accessioned,Date Retired,Status,Publication State,Suppressed,Child Record,Mediator,Access,Created At,Updated At
|
2
|
+
Lake Superior,"","30 x 38 cm.|Scale approximately 1:1,800,000|General Map Collection",eng,Society for the Diffusion of Useful Knowledge (Great Britain),fst00519759,Baldwin & Cradock (London),University of Minnesota,Maps,"","","","Superior, Lake Maps|2022-creator-sprint",1832,1832,1832-1832,Canada-- Ontario--Lake Superior,"-92.5,46,-83.5,50.5","POLYGON((-92.5 50.5, -83.5 50.5, -83.5 46, -92.5 46, -92.5 50.5))","","",64bd8c4c-8e60-4956-b43d-bdc3f93db488,05d-01|p16022coll230,"","","","",JPEG,,,false,,,,,,,,,https://umedia.lib.umn.edu/item/p16022coll230:321,,https://cdm16022.contentdm.oclc.org/iiif/info/p16022coll230/321/manifest.json,,,,,,,,,https://cdm16022.contentdm.oclc.org/utils/getthumbnail/collection/p16022coll230/id/321,p16022coll230:321,UMN_ALMA:9954050630001701,05d-01,"Use of this item may be governed by US and international copyright laws. You may be able to use this item, but copyright and other considerations may apply. For possible additional information or guidance on your use, please contact the contributing organization.","","",Public,JSON API,,2017-12-22|2022-09-26,,Active,published,false,false,"",,2021-04-26 17:06:38 UTC,2023-02-07 18:33:22 UTC
|
3
|
+
Lake Superior: Minnesota,Lake Superior,"This dataset is based on NOAA's Great Lakes Medium Resolution Digital Shoreline. The Lake Superior Shoreline was extracted and converted to a polygon feature class. Water and islands are differentiated. This layer is a medium-quality, general use digital vector dataset originally compiled from NOAA Nautical Charts, created by the Strategic Environmental Assessments Division of NOAA's Office of Ocean Resources, Conservation and Assessment. Nominal mapping scale is 1:70,000.",eng,United States. National Oceanic and Atmospheric Administration,fst00529308,"",Minnesota Geospatial Commons,Datasets,Vector data,National government records,Inland waters,|2022-creator-sprint,2020,2014-12-20,2020-2020,Minnesota,"-92.146,46.547,-83.935,48.769","POLYGON((-92.146 48.769, -83.935 48.769, -83.935 46.547, -92.146 46.547, -92.146 48.769))",http://sws.geonames.org/5037779,"",ba5cc745-21c5-4ae9-954b-72dd8db6815a,05a-01,"","","","",Shapefile,,,false,,https://resources.gisdata.mn.gov/pub/gdrs/data/pub/us_mn_state_dnr/water_lake_superior_basin/shp_water_lake_superior_basin.zip,,,,https://resources.gisdata.mn.gov/pub/gdrs/data/pub/us_mn_state_dnr/water_lake_superior_basin/metadata/metadata.html,,,https://gisdata.mn.gov/dataset/water-lake-superior-basin,,,,,,,,,,,https://resources.gisdata.mn.gov/pub/gdrs/data/pub/us_mn_state_dnr/water_lake_superior_basin/metadata/preview.jpg,82784459-acde-42ed-b615-d8300577110e,https://gisdata.mn.gov/dataset/water-lake-superior-basin,05a-01,"","","",Public,CKAN,,2020-08-31,,Active,published,false,false,"",,2021-04-26 17:03:04 UTC,2023-02-03 22:27:36 UTC
|
4
|
+
General chart of Lake Superior,"","Relief shown by hachures and spot heights. Depths shown by bathymetric tints, soundings, and isolines.; ""Catalogue No. 9.""; ""Issued October 11, 1919.""; Includes text, magnetic variations chart, lists of United States and Canadian canals, and dry docks list.|69 x 124 Centimeters|Scale 1:500,000|General Map Collection",eng,U.S. Lake Survey,"","On sale at U.S. Lake Survey Office (Detroit, Michigan)",University of Minnesota,Maps,"","","","","",,"",United States|Lake Superior,"-92.25,46,-84.25,49","POLYGON((-92.25 49, -84.25 49, -84.25 46, -92.25 46, -92.25 49))","","",64bd8c4c-8e60-4956-b43d-bdc3f93db488,05d-01|p16022coll230,"","","","",JPEG,,,false,,,,,,,,,https://umedia.lib.umn.edu/item/p16022coll230:4115,,https://cdm16022.contentdm.oclc.org/iiif/info/p16022coll230/4115/manifest.json,,,,,,,,,https://cdm16022.contentdm.oclc.org/utils/getthumbnail/collection/p16022coll230/id/4115,p16022coll230:4115,UMN_ALMA:9976559407801701,05d-01,"Use of this item may be governed by US and international copyright laws. You may be able to use this item, but copyright and other considerations may apply. For possible additional information or guidance on your use, please contact the contributing organization.","","",Public,JSON API,,2022-04-18|2022-09-26,,Active,published,false,false,"",,2022-09-26 22:33:45 UTC,2023-02-07 18:35:42 UTC
|
5
|
+
Lake Superior and the northern part of Michigan,"","Relief shown by hachures.; Prime meridians: Greenwich and Washington.; ""Entered according to act of Congress in the year 1855 by J.H. Colton & Co. ...""; From Colton's atlas of the world. New York: J.H. Colton & Co., 1855?. No. 43.|29 x 42 centimeters|Scale approximately 1:1,625,000|General Map Collection",eng,J.H. Colton & Co.,fst01457236,J.H. Colton & Co (New York),University of Minnesota,Maps,"","","",|2022-creator-sprint,1855,1855,1855-1855,Michigan,"-92.25,45.0,-83.4167,49.1667","POLYGON((-92.25 49.1667, -83.4167 49.1667, -83.4167 45.0, -92.25 45.0, -92.25 49.1667))","","",64bd8c4c-8e60-4956-b43d-bdc3f93db488,05d-01|p16022coll230,"","","","",JPEG,,,false,,,,,,,,,https://umedia.lib.umn.edu/item/p16022coll230:1933,,https://cdm16022.contentdm.oclc.org/iiif/info/p16022coll230/1933/manifest.json,,,,,,,,,https://cdm16022.contentdm.oclc.org/utils/getthumbnail/collection/p16022coll230/id/1933,p16022coll230:1933,UMN_ALMA:9920722310001701,05d-01,"Use of this item may be governed by US and international copyright laws. You may be able to use this item, but copyright and other considerations may apply. For possible additional information or guidance on your use, please contact the contributing organization.","","",Public,JSON API,,2021-07-19|2022-09-26,,Active,published,false,false,"",,2021-09-21 07:03:39 UTC,2023-02-07 18:33:35 UTC
|
@@ -2,7 +2,7 @@ default: &default
|
|
2
2
|
adapter: postgresql
|
3
3
|
encoding: unicode
|
4
4
|
host: <%= ENV['POSTGRES_HOST'] || '127.0.0.1' %>
|
5
|
-
port: <%= ENV['POSTGRES_PORT'] || '
|
5
|
+
port: <%= ENV['POSTGRES_PORT'] || '5555' %>
|
6
6
|
username: <%= ENV['POSTGRES_USER'] || 'postgres' %>
|
7
7
|
password: <%= ENV['POSTGRES_PASSWORD'] || 'postgres' %>
|
8
8
|
pool: 5
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "devise_invitable"
|
4
|
-
|
5
3
|
# Assuming you have not yet modified this file, each configuration option below
|
6
4
|
# is set to its default value. Note that some are commented out while others
|
7
5
|
# are not: uncommented lines are intended to protect your configuration from
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# syntax = docker/dockerfile:1
|
2
|
+
|
3
|
+
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
|
4
|
+
ARG RUBY_VERSION=3.3.5
|
5
|
+
FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim AS base
|
6
|
+
|
7
|
+
RUN apt-get update -qq && \
|
8
|
+
apt-get install --no-install-recommends -y build-essential git pkg-config nodejs npm curl libsqlite3-0
|
9
|
+
|
10
|
+
RUN npm install --global yarn
|
11
|
+
|
12
|
+
ENV RAILS_ENV="development" \
|
13
|
+
BUNDLE_PATH="/usr/local/bundle"
|
14
|
+
|
15
|
+
# Rails app lives here
|
16
|
+
WORKDIR /rails
|
17
|
+
|
18
|
+
# Install gems and javascript packages
|
19
|
+
COPY Gemfile .
|
20
|
+
RUN bundle install
|
21
|
+
COPY package.json .
|
22
|
+
RUN yarn install
|
23
|
+
|
24
|
+
FROM ghcr.io/geobtaa/geoblacklight_admin:base AS app
|
25
|
+
|
26
|
+
# Add application code
|
27
|
+
COPY . .
|
28
|
+
|
29
|
+
# Run the server script by default, this can be overwritten at runtime
|
30
|
+
EXPOSE 3000
|
31
|
+
CMD ["sh", "start-server"]
|
@@ -0,0 +1,42 @@
|
|
1
|
+
services:
|
2
|
+
app:
|
3
|
+
image: ghcr.io/geobtaa/geoblacklight_admin:main
|
4
|
+
ports:
|
5
|
+
- "3001:3001"
|
6
|
+
links:
|
7
|
+
- "solr:solr"
|
8
|
+
environment:
|
9
|
+
SOLR_URL: "http://solr:8983/solr/blacklight-core"
|
10
|
+
RAILS_DEVELOPMENT_HOSTS: ".githubpreview.dev,.preview.app.github.dev,.app.github.dev,.csb.app"
|
11
|
+
depends_on:
|
12
|
+
- solr
|
13
|
+
command: sh start-server.sh
|
14
|
+
solr:
|
15
|
+
image: solr:9.6.1
|
16
|
+
volumes:
|
17
|
+
- $PWD/solr/conf:/opt/solr/conf
|
18
|
+
ports:
|
19
|
+
- 8984:8983
|
20
|
+
entrypoint:
|
21
|
+
- docker-entrypoint.sh
|
22
|
+
- solr-precreate
|
23
|
+
- blacklight-core
|
24
|
+
- /opt/solr/conf
|
25
|
+
- "-Xms256m"
|
26
|
+
- "-Xmx512m"
|
27
|
+
postgres:
|
28
|
+
image: postgres:latest
|
29
|
+
env:
|
30
|
+
POSTGRES_HOST: 127.0.0.1
|
31
|
+
POSTGRES_PORT: 5432
|
32
|
+
POSTGRES_DB: geoblacklight_development
|
33
|
+
POSTGRES_USER: postgres
|
34
|
+
POSTGRES_PASSWORD: postgres
|
35
|
+
ports:
|
36
|
+
- 5432:5432
|
37
|
+
# Set health checks to wait until postgres has started
|
38
|
+
options:
|
39
|
+
--health-cmd pg_isready
|
40
|
+
--health-interval 10s
|
41
|
+
--health-timeout 5s
|
42
|
+
--health-retries 5
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
bundle install
|
4
|
+
yarn install
|
5
|
+
|
6
|
+
# Build and Install local copy of @geoblackligt/frontend
|
7
|
+
# These steps are included in the docker image instead if the image build script
|
8
|
+
# to reduce the size of the layers that docker compose has to pull with each new version.
|
9
|
+
gempath=$(bundle exec gem which geoblacklight_admin | sed 's/\/lib\/geoblacklight_admin.rb//')
|
10
|
+
if [ ! -d "$gempath/dist/" ]; then
|
11
|
+
cd $gempath
|
12
|
+
yarn install
|
13
|
+
yarn vite build
|
14
|
+
cd -
|
15
|
+
fi
|
16
|
+
yarn add file:$gempath
|
17
|
+
|
18
|
+
# Start the server
|
19
|
+
bundle exec rake db:prepare
|
20
|
+
bundle exec rake geoblacklight:index:seed
|
21
|
+
bundle exec rails server -b 0.0.0.0 -p 3001
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require "rake"
|
2
|
+
require "csv"
|
3
|
+
|
4
|
+
namespace :geoblacklight_admin do
|
5
|
+
namespace :distributions do
|
6
|
+
desc "Migrate distributions into DocumentDistributions"
|
7
|
+
task migrate: :environment do
|
8
|
+
total_documents_processed = 0
|
9
|
+
puts "\n--- Migration Start ---"
|
10
|
+
Document.find_in_batches(batch_size: 1000) do |documents|
|
11
|
+
documents.each do |document|
|
12
|
+
# Moves AttrJson-based dct_references_s and Multiple Downloads into DocumentDistributions
|
13
|
+
|
14
|
+
document.distributions_csv.each do |distribution|
|
15
|
+
DocumentDistribution.find_or_create_by!(
|
16
|
+
friendlier_id: distribution[0],
|
17
|
+
reference_type_id: ReferenceType.find_by(name: distribution[1]).id,
|
18
|
+
url: distribution[2],
|
19
|
+
label: distribution[3]
|
20
|
+
)
|
21
|
+
end
|
22
|
+
rescue => e
|
23
|
+
puts "\nError processing distributions for document: #{document.friendlier_id} - #{e.inspect}\n"
|
24
|
+
end
|
25
|
+
total_documents_processed += documents.size
|
26
|
+
puts "Processed #{documents.size} documents in this batch, total processed: #{total_documents_processed}"
|
27
|
+
end
|
28
|
+
puts "--- Migration End ---\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Audit the distributions migration"
|
32
|
+
task audit: :environment do
|
33
|
+
total_documents_processed = 0
|
34
|
+
puts "\n--- Audit Start ---"
|
35
|
+
Document.find_in_batches(batch_size: 1000) do |documents|
|
36
|
+
documents.each do |document|
|
37
|
+
# Document > Distributions as CSV
|
38
|
+
dr_csv = document.references_csv.sort
|
39
|
+
|
40
|
+
# document_distributions
|
41
|
+
doc_dists = document.document_distributions.collect { |dr| dr.to_csv }.sort
|
42
|
+
|
43
|
+
if dr_csv != doc_dists
|
44
|
+
puts "\nNO MATCH"
|
45
|
+
puts "Document: #{document.friendlier_id}"
|
46
|
+
puts "CSV Distributions Sorted: #{dr_csv.sort.inspect}"
|
47
|
+
puts "Document Distributions Sorted: #{doc_dists.sort.inspect}\n"
|
48
|
+
end
|
49
|
+
rescue => e
|
50
|
+
puts "\nError auditing distributions for document: #{document.friendlier_id} - #{e.inspect}\n"
|
51
|
+
end
|
52
|
+
total_documents_processed += documents.size
|
53
|
+
puts "Processed #{documents.size} documents in this batch, total processed: #{total_documents_processed}"
|
54
|
+
end
|
55
|
+
puts "--- Audit End ---\n"
|
56
|
+
end
|
57
|
+
|
58
|
+
task finalize: :environment do
|
59
|
+
# Step 1 - After migrate, flip the ENV var feature flag
|
60
|
+
# Done: Remove multiple download links from Documents
|
61
|
+
# Done: Remove multiple download links from FormElements (it's a feature there)
|
62
|
+
# Done: Remove multiple download links from FormNav (link)
|
63
|
+
# Done: Add DocumentDistributions to the FormElements (as a feature - manual)
|
64
|
+
|
65
|
+
# Step 2 - Finalize
|
66
|
+
# Remove AttrJson dct_references_s values from Documents (data is redundant and/or incorrect)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "rake"
|
1
2
|
require "csv"
|
2
3
|
|
3
4
|
namespace :geoblacklight_admin do
|
@@ -7,5 +8,35 @@ namespace :geoblacklight_admin do
|
|
7
8
|
deleted_orphans = GeoblacklightAdmin::SolrUtils.delete_solr_orphans(batch_size: 1000)
|
8
9
|
puts "Deleted: #{deleted_orphans.inspect}"
|
9
10
|
end
|
11
|
+
|
12
|
+
desc "Reindex all Documents - via Kithe"
|
13
|
+
task reindex: :environment do
|
14
|
+
Kithe::Indexable.index_with(batching: true) do
|
15
|
+
progress_bar = ProgressBar.create(total: Document.count, format: Kithe::STANDARD_PROGRESS_BAR_FORMAT)
|
16
|
+
|
17
|
+
scope = Kithe::Model.where(kithe_model_type: 1)
|
18
|
+
|
19
|
+
scope.find_each do |model|
|
20
|
+
progress_bar.title = "#{model.class.name}:#{model.friendlier_id}"
|
21
|
+
model.update_index
|
22
|
+
progress_bar.increment
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "Reindex all Documents - via Rails"
|
28
|
+
task reindex_rails: :environment do
|
29
|
+
total_documents_processed = 0
|
30
|
+
Document.find_in_batches(batch_size: 1000) do |documents|
|
31
|
+
documents.each do |document|
|
32
|
+
document.update_index
|
33
|
+
rescue => e
|
34
|
+
puts "Error updating index for document: #{document.friendlier_id}"
|
35
|
+
puts e.message
|
36
|
+
end
|
37
|
+
total_documents_processed += documents.size
|
38
|
+
puts "Processed #{documents.size} documents in this batch, total processed: #{total_documents_processed}"
|
39
|
+
end
|
40
|
+
end
|
10
41
|
end
|
11
42
|
end
|