Index Solr documents - Part 4 - GeoBlacklight Workshop"
Feb 9, 2015
Index Solr documents
GeoBlacklight uses the GeoBlacklight Schema, Version 1.0 as a template for metadata documents indexed by Solr.
GeoBlacklight provides a rake task to index documents as fixtures for tests. We will use this rake task to index several documents as an example.
Download fixture metadata documents
Assuming that you have already navigated to the directory of your GeoBlacklight app, create a directory for some Solr documents and then move to it:
$ mkdir -p spec/fixtures/solr_documents && cd spec/fixtures/solr_documents
Download some metadata documents (in JSON format) to the directory
$ curl -O https://gist.githubusercontent.com/mejackreed/84abc598927c43af665b/raw/geoblacklight-documents.json
Move back to app root directory
$ cd - # Or cd ../../../
Make sure your Solr server and Rails application are started.
$ rake geoblacklight:server
Optional Commit your work
$ git add . $ git commit -m 'Adds in JSON fixtures'
The fixtures directory is useful for quickly indexing a small number documents in Solr (built specifically for populating Solr for testing). I would caution though in using this task for large scale indexing and committing, as we’ve developed other best practices for production-scale indexing.
Want to index some more documents? Check out this tutorial on how to easily index metadata from OpenGeoMetadata.
- Part 1 - GeoBlacklight overview
- Part 2 - Setting up your environment
- Part 3 - Create your application
- Part 4 - Index Solr documents
- Part 5 - Customize your application
This work is licensed under a Creative Commons Attribution 4.0 International License.