geoblacklight_admin 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -55
  3. data/Rakefile +3 -0
  4. data/app/assets/javascripts/geoblacklight_admin/chosen.js +7 -3
  5. data/app/assets/javascripts/geoblacklight_admin/datepicker.js +2 -2
  6. data/app/assets/javascripts/geoblacklight_admin/inputmask.js +2 -2
  7. data/app/assets/javascripts/geoblacklight_admin/truncate.js +2 -2
  8. data/app/assets/javascripts/geoblacklight_admin.js +1 -4
  9. data/app/assets/stylesheets/geoblacklight_admin/_core.scss +3 -1
  10. data/app/assets/stylesheets/geoblacklight_admin/modules/_images.scss +4 -0
  11. data/app/assets/stylesheets/geoblacklight_admin/modules/_nav.scss +4 -0
  12. data/app/assets/stylesheets/geoblacklight_admin/modules/_results.scss +5 -0
  13. data/app/controllers/admin/admin_controller.rb +1 -1
  14. data/app/controllers/admin/advanced_search_controller.rb +0 -1
  15. data/app/controllers/admin/assets_controller.rb +142 -0
  16. data/app/controllers/admin/bulk_actions_controller.rb +1 -1
  17. data/app/controllers/admin/document_accesses_controller.rb +3 -3
  18. data/app/controllers/admin/document_assets_controller.rb +33 -23
  19. data/app/controllers/admin/documents_controller.rb +6 -2
  20. data/app/controllers/admin/ids_controller.rb +0 -1
  21. data/app/controllers/admin/imports_controller.rb +2 -2
  22. data/app/helpers/asset_helper.rb +8 -0
  23. data/app/helpers/document_helper.rb +4 -0
  24. data/app/helpers/geoblacklight_admin_helper.rb +11 -1
  25. data/{lib/generators/geoblacklight_admin/templates → app}/javascript/controllers/results_controller.js +38 -0
  26. data/app/javascript/entrypoints/engine.js +8 -0
  27. data/app/javascript/index.js +8 -0
  28. data/app/jobs/bulk_action_revert_document_job.rb +2 -2
  29. data/app/jobs/bulk_action_run_document_job.rb +5 -1
  30. data/app/jobs/bulk_action_run_job.rb +11 -1
  31. data/app/jobs/geoblacklight_admin/delete_thumbnail_job.rb +17 -0
  32. data/app/jobs/geoblacklight_admin/remove_parent_dct_references_uri_job.rb +16 -0
  33. data/app/jobs/geoblacklight_admin/set_parent_dct_references_uri_job.rb +19 -0
  34. data/app/jobs/geoblacklight_admin/store_image_job.rb +21 -2
  35. data/app/models/asset.rb +38 -0
  36. data/app/models/blacklight_api.rb +2 -2
  37. data/app/models/blacklight_api_facets.rb +1 -1
  38. data/app/models/blacklight_api_ids.rb +2 -2
  39. data/app/models/bulk_action_document_state_machine.rb +2 -4
  40. data/app/models/bulk_action_state_machine.rb +3 -3
  41. data/app/models/bulk_actions/change_publication_state.rb +10 -0
  42. data/app/models/document/reference.rb +24 -0
  43. data/app/models/document.rb +122 -11
  44. data/app/models/document_thumbnail_state_machine.rb +22 -0
  45. data/app/models/document_thumbnail_transition.rb +26 -0
  46. data/app/models/element.rb +1 -1
  47. data/app/models/geoblacklight_admin/field_mappings_btaa_aardvark.rb +7 -1
  48. data/app/models/geoblacklight_admin/schema.rb +37 -1
  49. data/app/models/geoblacklight_admin/solr_utils.rb +87 -0
  50. data/app/models/kithe/vips_cli_image_to_png.rb +114 -0
  51. data/app/services/geoblacklight_admin/image_service/iiif.rb +2 -2
  52. data/app/services/geoblacklight_admin/image_service/iiif_manifest.rb +111 -0
  53. data/app/services/geoblacklight_admin/image_service/tms.rb +50 -0
  54. data/app/services/geoblacklight_admin/image_service/wms.rb +1 -4
  55. data/app/services/geoblacklight_admin/image_service.rb +16 -40
  56. data/app/services/geoblacklight_admin/item_viewer.rb +1 -1
  57. data/app/uploaders/asset_uploader.rb +6 -11
  58. data/app/views/admin/assets/_form.html.erb +19 -0
  59. data/app/views/admin/assets/display_attach_form.html.erb +39 -0
  60. data/app/views/admin/assets/edit.html.erb +9 -0
  61. data/app/views/admin/assets/index.html.erb +75 -0
  62. data/app/views/admin/assets/show.html.erb +100 -0
  63. data/app/views/admin/bulk_actions/index.html.erb +50 -48
  64. data/app/views/admin/bulk_actions/show.html.erb +3 -2
  65. data/app/views/admin/document_accesses/index.html.erb +68 -64
  66. data/app/views/admin/document_assets/_form.html.erb +17 -0
  67. data/app/views/admin/document_assets/display_attach_form.html.erb +4 -9
  68. data/app/views/admin/document_assets/edit.html.erb +5 -0
  69. data/app/views/admin/document_assets/index.html.erb +88 -72
  70. data/app/views/admin/document_downloads/index.html.erb +64 -62
  71. data/app/views/admin/documents/_document.html.erb +37 -16
  72. data/app/views/admin/documents/_form.html.erb +21 -6
  73. data/app/views/admin/documents/_form_nav.html.erb +12 -3
  74. data/app/views/admin/documents/_result_selected_options.html.erb +6 -1
  75. data/app/views/admin/documents/admin.html.erb +210 -0
  76. data/app/views/admin/documents/index.html.erb +10 -1
  77. data/app/views/admin/documents/versions.html.erb +3 -3
  78. data/app/views/admin/elements/index.html.erb +55 -54
  79. data/app/views/admin/form_elements/index.html.erb +38 -35
  80. data/app/views/admin/imports/index.html.erb +52 -50
  81. data/app/views/admin/layouts/application.html.erb +7 -4
  82. data/app/views/admin/shared/_js_behaviors.html.erb +6 -3
  83. data/app/views/admin/shared/_navbar.html.erb +11 -8
  84. data/config/locales/documents.en.yml +6 -0
  85. data/config/routes.rb +1 -0
  86. data/config/vite.json +14 -0
  87. data/db/migrate/20240619171628_create_document_thumbnail_statesman.rb +18 -0
  88. data/lib/generators/geoblacklight_admin/config_generator.rb +63 -15
  89. data/lib/generators/geoblacklight_admin/install_generator.rb +1 -0
  90. data/lib/generators/geoblacklight_admin/templates/api_controller.rb +0 -2
  91. data/lib/generators/geoblacklight_admin/templates/base.html.erb +53 -0
  92. data/lib/generators/geoblacklight_admin/templates/config/initializers/kithe.rb +1 -0
  93. data/lib/generators/geoblacklight_admin/templates/config/settings.yml +15 -1
  94. data/lib/generators/geoblacklight_admin/templates/config/vite.json +16 -0
  95. data/lib/generators/geoblacklight_admin/templates/frontend/entrypoints/application.js +30 -0
  96. data/lib/generators/geoblacklight_admin/templates/package-test.json +10 -0
  97. data/lib/generators/geoblacklight_admin/templates/package.json +5 -29
  98. data/lib/generators/geoblacklight_admin/templates/vite.config.ts +8 -0
  99. data/lib/geoblacklight_admin/engine.rb +1 -0
  100. data/lib/geoblacklight_admin/rake_task.rb +5 -0
  101. data/lib/geoblacklight_admin/tasks/images.rake +33 -0
  102. data/lib/geoblacklight_admin/tasks/solr.rake +11 -0
  103. data/lib/geoblacklight_admin/version.rb +1 -1
  104. metadata +75 -19
  105. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/application_controller.js +0 -17
  106. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/document_controller.js +0 -26
  107. data/lib/generators/geoblacklight_admin/templates/javascript/controllers/index.js +0 -10
  108. data/lib/tasks/geoblacklight_admin/images.rake +0 -30
  109. data/lib/tasks/geoblacklight_admin.rake +0 -213
@@ -11,16 +11,29 @@ module GeoblacklightAdmin
11
11
  1. Copies GBL Admin initializer files to host config
12
12
  2. Copies database.yml connection to host config
13
13
  3. Copies sidekiq.yml connection to host config
14
- 4. Copies settings.yml to host config
15
14
  5. Copies .env.development and .env.test to host
15
+ 4. Copies settings.yml to host config
16
+ create_solr_yml
16
17
  6. Copies JSON Schema to host
17
18
  7. Copies solr/* to host
18
19
  8. Sets Routes
19
- 9. Sets Gems
20
+ set_development_mailer_host
20
21
  11.Sets DB Seeds
21
- 11.Sets ActiveStorage
22
22
  12.Sets Pagy Backend
23
-
23
+ 11.Sets ActiveStorage
24
+ add_api_controller
25
+ add_user_util_links
26
+ copy_catalog_index_view
27
+ add_show_sidebar
28
+ copy_app_javascript
29
+ copy_app_images
30
+ add_package_json
31
+ add_assets_initialier
32
+ add_kithe_bulk_loading_service
33
+ add_kithe_model_to_solr_document
34
+ add_search_builder_publication_state_concern
35
+ add_import_id_facet
36
+ add_vite_rails_config
24
37
  DESCRIPTION
25
38
 
26
39
  def create_gbl_admin_initializer_files
@@ -88,6 +101,21 @@ module GeoblacklightAdmin
88
101
  # Root
89
102
  root to: "documents#index"
90
103
 
104
+ # Assets
105
+ # Note "assets" is Rails reserved word for routing, oops. So we use
106
+ # asset_files.
107
+ resources :assets, path: "asset_files" do
108
+ collection do
109
+ get "display_attach_form"
110
+ post "attach_files"
111
+
112
+ get "destroy_all"
113
+ post "destroy_all"
114
+ end
115
+
116
+ post :sort, on: :collection
117
+ end
118
+
91
119
  # Bulk Actions
92
120
  resources :bulk_actions do
93
121
  patch :run, on: :member
@@ -143,6 +171,7 @@ module GeoblacklightAdmin
143
171
 
144
172
  # Documents
145
173
  resources :documents do
174
+ get "admin"
146
175
  get "versions"
147
176
 
148
177
  # DocumentAccesses
@@ -216,8 +245,15 @@ module GeoblacklightAdmin
216
245
  end
217
246
  end
218
247
 
248
+ # Assets
249
+ get "/asset_files/ingest", to: "assets#display_attach_form", as: "assets_ingest"
250
+ post "/asset_files/ingest", to: "assets#attach_files"
251
+
252
+ # DocumentAssets
219
253
  get "/documents/:id/ingest", to: "document_assets#display_attach_form", as: "asset_ingest"
220
254
  post "/documents/:id/ingest", to: "document_assets#attach_files"
255
+
256
+ # Asset Direct Upload
221
257
  mount Kithe::AssetUploader.upload_endpoint(:cache) => "/direct_upload", :as => :direct_app_upload
222
258
 
223
259
  resources :collections, except: [:show]
@@ -264,9 +300,9 @@ module GeoblacklightAdmin
264
300
  def add_activestorage
265
301
  append_to_file "app/assets/javascripts/application.js" do
266
302
  "
267
-
268
303
  // Required by GBL Admin
269
- //= require activestorage"
304
+ //= require activestorage
305
+ //= require geoblacklight_admin"
270
306
  end
271
307
  end
272
308
 
@@ -286,14 +322,6 @@ module GeoblacklightAdmin
286
322
  copy_file "_show_sidebar.html.erb", "app/views/catalog/_show_sidebar.html.erb"
287
323
  end
288
324
 
289
- # @TODO
290
- # I'm certain this is not the best way to inject our JS behaviors into the root app
291
- # But for now, this will do...
292
- # Long term I hope to avoid webpack here altogether.
293
- def copy_app_javascript
294
- directory "javascript", "app/javascript", force: true
295
- end
296
-
297
325
  def copy_app_images
298
326
  copy_file "images/bookmark-regular.svg", "app/assets/images/bookmark-regular.svg"
299
327
  copy_file "images/bookmark-solid.svg", "app/assets/images/bookmark-solid.svg"
@@ -303,13 +331,18 @@ module GeoblacklightAdmin
303
331
  copy_file "package.json", "package.json", force: true
304
332
  end
305
333
 
334
+ def copy_rake_tasks
335
+ append_to_file "Rakefile", "require \"geoblacklight_admin/rake_task\"\n"
336
+ end
337
+
306
338
  def add_assets_initialier
307
339
  append_to_file "config/initializers/assets.rb" do
308
340
  "
309
341
  # GBL ADMIN
310
342
  Rails.application.config.assets.paths << Rails.root.join('node_modules')
311
343
  Rails.application.config.assets.precompile += %w( geoblacklight_admin.js )
312
- Rails.application.config.assets.precompile += %w[application.js]"
344
+ Rails.application.config.assets.precompile += %w[application.js]
345
+ Rails.application.config.assets.precompile += %w[application.css]"
313
346
  end
314
347
  end
315
348
 
@@ -340,5 +373,20 @@ module GeoblacklightAdmin
340
373
  "\nconfig.add_facet_field Settings.FIELDS.B1G_IMPORT_ID, label: 'Import ID', show: false\n"
341
374
  end
342
375
  end
376
+
377
+ def add_vite_rails_config
378
+ copy_file "base.html.erb", "app/views/layouts/blacklight/base.html.erb", force: true
379
+ copy_file "vite.config.ts", "vite.config.ts", force: true
380
+ copy_file "config/vite.json", "config/vite.json", force: true
381
+ copy_file "frontend/entrypoints/application.js", "app/javascript/entrypoints/application.js", force: true
382
+ end
383
+
384
+ # Run bundle with vite install
385
+ def bundle_install
386
+ Bundler.with_clean_env do
387
+ run "bundle install"
388
+ run "bundle exec vite install"
389
+ end
390
+ end
343
391
  end
344
392
  end
@@ -45,6 +45,7 @@ module GeoblacklightAdmin
45
45
  end
46
46
 
47
47
  def install_yarn
48
+ run "yarn add @geoblacklight/frontend@^4.4.6"
48
49
  run "yarn install"
49
50
  end
50
51
  end
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "blacklight/catalog"
4
-
5
3
  # Admin::ApiController
6
4
  module Admin
7
5
  class ApiController < ApplicationController
@@ -0,0 +1,53 @@
1
+ <!DOCTYPE html>
2
+ <%= content_tag :html, class: 'no-js', **html_tag_attributes do %>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7
+ <meta name="geoblacklight-version" content="<%= Geoblacklight::VERSION %>">
8
+
9
+ <!-- Internet Explorer use the highest version available -->
10
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
11
+
12
+ <title><%= render_page_title %></title>
13
+ <script>
14
+ document.querySelector('html').classList.remove('no-js');
15
+ </script>
16
+ <%= opensearch_description_tag application_name, opensearch_catalog_url(format: 'xml') %>
17
+ <%= favicon_link_tag %>
18
+ <%= stylesheet_link_tag "application", media: "all", "data-turbo-track": "reload" %>
19
+ <%= javascript_include_tag "application", "data-turbo-track": "reload" %>
20
+
21
+ <%= vite_client_tag %>
22
+ <%= vite_javascript_tag 'application' %>
23
+ <% if openlayers_container? %>
24
+ <%= vite_javascript_tag 'ol' %>
25
+ <% elsif iiif_manifest_container? %>
26
+ <%= vite_javascript_tag 'clover' %>
27
+ <% end %>
28
+
29
+ <%= csrf_meta_tags %>
30
+ <%= content_for(:head) %>
31
+ </head>
32
+ <body class="<%= render_body_class %>">
33
+ <nav id="skip-link" role="navigation" aria-label="<%= t('blacklight.skip_links.label') %>">
34
+ <%= link_to t('blacklight.skip_links.search_field'), '#search_field', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
35
+ <%= link_to t('blacklight.skip_links.main_content'), '#main-container', class: 'element-invisible element-focusable rounded-bottom py-2 px-3', data: { turbolinks: 'false' } %>
36
+ <%= content_for(:skip_links) %>
37
+ </nav>
38
+ <%= render partial: 'shared/header_navbar' %>
39
+
40
+ <main id="main-container" class="<%= container_classes %>" role="main" aria-label="<%= t('blacklight.main.aria.main_container') %>">
41
+ <%= content_for(:container_header) %>
42
+
43
+ <%= render partial: 'shared/flash_msg', layout: 'shared/flash_messages' %>
44
+
45
+ <div class="row">
46
+ <%= content_for?(:content) ? yield(:content) : yield %>
47
+ </div>
48
+ </main>
49
+
50
+ <%= render partial: 'shared/footer' %>
51
+ <%= render partial: 'shared/modal' %>
52
+ </body>
53
+ <% end %>
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "simple_form"
3
4
  require "kithe"
4
5
 
5
6
  traject_logger = ActiveSupport::Logger.new("#{Rails.root}/log/traject.log")
@@ -125,6 +125,8 @@ WEBSERVICES_SHOWN:
125
125
  - 'tiled_map_layer'
126
126
  - 'dynamic_map_layer'
127
127
  - 'image_map_layer'
128
+ - 'cog'
129
+ - 'pmtiles'
128
130
 
129
131
  # Display Notes to display / Non-prefixed default bootstrap class is alert-secondary
130
132
  DISPLAY_NOTES_SHOWN:
@@ -287,10 +289,22 @@ HELP_TEXT:
287
289
  - 'wms'
288
290
  - 'tms'
289
291
  - 'oembed'
292
+ - 'cog'
293
+ - 'pmtiles'
294
+
290
295
 
291
296
  # Enable catalog#show sidebar static map for items with the following viewer protocols
292
297
  SIDEBAR_STATIC_MAP:
293
298
  - 'iiif'
294
299
  - 'iiif_manifest'
295
300
 
296
- GBLSI_THUMBNAIL_FIELD: 'b1g_image_ss'
301
+ GBLSI_THUMBNAIL_FIELD: 'b1g_image_ss'
302
+
303
+ #########
304
+ # GBL ADMIN SETTINGS
305
+
306
+ # Used to generate derivatives in app/uploaders/asset_uploader.rb
307
+ # Hash of thumbnail sizes
308
+ GBL_ADMIN_THUMBNAIL_WIDTHS:
309
+ mini: 50
310
+ standard: 200
@@ -0,0 +1,16 @@
1
+ {
2
+ "all": {
3
+ "sourceCodeDir": "app/javascript",
4
+ "watchAdditionalPaths": []
5
+ },
6
+ "development": {
7
+ "autoBuild": true,
8
+ "publicOutputDir": "vite-dev",
9
+ "port": 3036
10
+ },
11
+ "test": {
12
+ "autoBuild": true,
13
+ "publicOutputDir": "vite-test",
14
+ "port": 3037
15
+ }
16
+ }
@@ -0,0 +1,30 @@
1
+ // To see this message, add the following to the `<head>` section in your
2
+ // views/layouts/application.html.erb
3
+ //
4
+ // <%= vite_client_tag %>
5
+ // <%= vite_javascript_tag 'application' %>
6
+ console.log('Vite ⚡️ Rails - Local')
7
+
8
+ // If using a TypeScript entrypoint file:
9
+ // <%= vite_typescript_tag 'application' %>
10
+ //
11
+ // If you want to use .jsx or .tsx, add the extension:
12
+ // <%= vite_javascript_tag 'application.jsx' %>
13
+
14
+ // console.log('Visit the guide for more information: ', 'https://vite-ruby.netlify.app/guide/rails')
15
+
16
+ // Example: Load Rails libraries in Vite.
17
+ //
18
+ // import * as Turbo from '@hotwired/turbo'
19
+ // Turbo.start()
20
+ //
21
+ // import ActiveStorage from '@rails/activestorage'
22
+ // ActiveStorage.start()
23
+ //
24
+ // // Import all channels.
25
+ // const channels = import.meta.globEager('./**/*_channel.js')
26
+
27
+ // Example: Import a stylesheet in app/frontend/index.css
28
+ // import '~/index.css'
29
+
30
+ import '@geoblacklight/admin'
@@ -0,0 +1,10 @@
1
+ {
2
+ "devDependencies": {
3
+ "vite": "^5.1.5",
4
+ "vite-plugin-ruby": "^5.0.0",
5
+ "vite-plugin-rails": "^0.5.0"
6
+ },
7
+ "scripts": {
8
+ "postinstall": "yarn link @geoblacklight/admin"
9
+ }
10
+ }
@@ -1,35 +1,11 @@
1
1
  {
2
- "name": "internal",
3
- "private": true,
4
2
  "dependencies": {
5
- "@babel/plugin-proposal-private-methods": "^7.18.6",
6
- "@babel/plugin-proposal-private-property-in-object": "^7.20.0",
7
- "@nathanvda/cocoon": "^1.2.14",
8
- "@rails/actioncable": "^6.0.0",
9
- "@rails/activestorage": "^6.0.0",
10
- "@rails/ujs": "^6.0.0",
11
- "@rails/webpacker": "5.4.3",
12
- "bootstrap": "^4.5.0",
13
- "bootstrap-datepicker": "^1.9.0",
14
- "chosen-jquery": "^0.1.1",
15
- "devbridge-autocomplete": "^1.4.10",
16
- "highcharts": "^9.3.2",
17
- "i18n": "^0.15.1",
18
- "inputmask": "^5.0.3",
19
- "moment": "^2.29.4",
20
- "node-forge": "^1.0.0",
21
- "popper.js": "^1.16.1",
22
- "serialize-javascript": "^3.1.0",
23
- "shave": "^2.5.10",
24
- "stimulus": "^1.1.1",
25
- "stimulus-scroll-to": "^2.0.1",
26
- "turbolinks": "^5.2.0",
27
- "webpack": "^4.46.0",
28
- "webpack-cli": "^3.3.12",
29
- "yargs-parser": "^13.1.2"
3
+ "@geoblacklight/frontend": "^4.4",
4
+ "@geoblacklight/admin": "^0.4"
30
5
  },
31
- "version": "0.1.0",
32
6
  "devDependencies": {
33
- "webpack-dev-server": "^3"
7
+ "vite": "^5.1.5",
8
+ "vite-plugin-ruby": "^5.0.0",
9
+ "vite-plugin-rails": "^0.5.0"
34
10
  }
35
11
  }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vite'
2
+ import rails from 'vite-plugin-rails'
3
+
4
+ export default defineConfig({
5
+ plugins: [
6
+ rails(),
7
+ ]
8
+ })
@@ -9,6 +9,7 @@ module GeoblacklightAdmin
9
9
  initializer "geoblacklight_admin.helpers" do
10
10
  config.after_initialize do
11
11
  ActionView::Base.include GeoblacklightAdminHelper
12
+ ActionView::Base.include AssetHelper
12
13
  ActionView::Base.include BulkActionsHelper
13
14
  ActionView::Base.include DocumentHelper
14
15
  ActionView::Base.include FormInputHelper
@@ -0,0 +1,5 @@
1
+ module GeoblacklightAdmin
2
+ module RakeTask
3
+ Dir[File.expand_path(File.join(File.dirname(__FILE__), "tasks/*.rake"))].each { |ext| load ext } if defined?(Rake)
4
+ end
5
+ end
@@ -0,0 +1,33 @@
1
+ require "csv"
2
+
3
+ namespace :geoblacklight_admin do
4
+ namespace :images do
5
+ desc "Harvest image for specific document - priority queue"
6
+ task harvest_doc_id: :environment do
7
+ GeoblacklightAdmin::StoreImageJob.perform_later(ENV["DOC_ID"], nil, :priority)
8
+ end
9
+
10
+ desc "Harvest all images - uses low priority queue"
11
+ task harvest_all: [:environment] do
12
+ cursor_mark = "*"
13
+ loop do
14
+ response = Blacklight.default_index.connection.get(
15
+ "select", params: {
16
+ q: "*:*", # all docs
17
+ fl: "geomg_id_s, id",
18
+ cursorMark: cursor_mark, # use the cursor mark to handle paging
19
+ rows: 1000,
20
+ sort: "geomg_id_s asc" # must sort by id to use the cursor mark
21
+ }
22
+ )
23
+
24
+ response["response"]["docs"].each do |doc|
25
+ GeoblacklightAdmin::StoreImageJob.perform_later(doc["id"], nil, :low_priority)
26
+ end
27
+
28
+ break if response["nextCursorMark"] == cursor_mark # this means the result set is finished
29
+ cursor_mark = response["nextCursorMark"]
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,11 @@
1
+ require "csv"
2
+
3
+ namespace :geoblacklight_admin do
4
+ namespace :solr do
5
+ desc "Delete orphans from Solr"
6
+ task delete_orphans: :environment do
7
+ deleted_orphans = GeoblacklightAdmin::SolrUtils.delete_solr_orphans(batch_size: 1000)
8
+ puts "Deleted: #{deleted_orphans.inspect}"
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GeoblacklightAdmin
4
- VERSION = "0.4.1"
4
+ VERSION = "0.5.0"
5
5
  end