This is part of a larger tutorial created and presented as "A hands on introduction to GeoBlacklight".

Index Solr documents

  1. Overview
  2. Download fixture documents
  3. Index documents

Overview

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

  1. 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
    
  2. Download some metadata documents (in JSON format) to the directory

    $ curl -O https://gist.githubusercontent.com/mejackreed/84abc598927c43af665b/raw/geoblacklight-documents.json
    
  3. Move back to app root directory

    $ cd - # Or cd ../../../
    
  4. Make sure your Solr server and Rails application are started.

    $ rake geoblacklight:server
    
  5. 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.

Now you should see facets listed on the lower left hand part of the page. Try a search! You can search for * to search for everything.

Want to index some more documents? Check out this tutorial on how to easily index metadata from OpenGeoMetadata.