diff --git a/README.md b/README.md index a546492f..2e6e0684 100644 --- a/README.md +++ b/README.md @@ -88,3 +88,21 @@ Note: You'll know this step is necessary if an individual spec fails with an err ```plaintext Blacklight::Exceptions::ECONNREFUSED: Connection refused - Unable to connect to Solr instance using # ``` + +### Loading NYU Data Locally + +First, start up the Rails app if it's not already running: + +```bash +$ bundle exec rake sdr:server +``` + +This will ensure Solr is up and running. + +Then in another terminal run the following Rake task: + +```bash +$ bundle exec rake sdr:load_nyu_data +``` + +Once completed, head to and you should have a lot more data to work with. diff --git a/lib/tasks/sdr.rake b/lib/tasks/sdr.rake index 63d6a90f..b64c0a07 100644 --- a/lib/tasks/sdr.rake +++ b/lib/tasks/sdr.rake @@ -78,4 +78,24 @@ namespace :sdr do end end end + + desc 'Clone and index NYU data for local development' + task load_nyu_data: :environment do + exit unless Rails.env.development? + + puts 'Removing existing edu.nyu repo...' + FileUtils.rm_rf('tmp/opengeometadata/edu.nyu') + + puts 'Cloning edu.nyu repository...' + system 'bundle exec sdr-cli clone --repo=edu.nyu' + + puts 'Deleting Solr index...' + Blacklight.default_index.connection.delete_by_query '*:*' + Blacklight.default_index.connection.commit + + puts 'Indexing edu.nyu Aardvark files...' + system "bundle exec sdr-cli index --directory=\"tmp/opengeometadata/edu.nyu/metadata-aardvark/**/*.json\" --solr_url=\"#{Settings.SOLR_URL}\"" + + puts 'Done!' + end end