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 GeoBlacklight-Schema 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. Create and move to a directory for your documents

    $ 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
    

Index fixture metadata documents

  1. Run the GeoBlacklight fixture indexer

    $ rake geoblacklight:solr:seed
    

The GeoBlacklight Solr seed task, indexes metadata documents (in JSON format) stored in the spec/fixtures/solr_documents directory.

  1. Optional Commit your work

    $ git add .
    $ git commit -m 'Adds in JSON fixtures'
    

As stated above, this rake task 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 commiting, 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.