About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
indexing:marc:multiple_configs

Managing Multiple SolrMarc Configurations

There are often situations where you need to apply different configuration settings to different MARC files. For example, if you load files from different libraries, you may wish to use different hard-coded “collection,” “institution” and/or “building” facets for each file. Fortunately, the SolrMarc import tool makes this fairly easy to accomplish.

SolrMarc Configuration Files

It is important to understand that SolrMarc has two different kinds of configuration files:

  • the SolrMarc configuration file (called import.properties by default)
  • the index specification file (exemplified by marc.properties and marc_local.properties)

The configuration file provides high-level configuration settings for SolrMarc, such as the URL of the Solr instance that will receive MARC records, and the name(s) of index specification file(s) to use.

The index specification file(s) contain the rules for performing the indexing operation.

The -p Switch

The ./import-marc.sh script which VuFind provides as a convenient wrapper around SolrMarc includes a -p switch, which can be used to specify the full path of a SolrMarc configuration file to load. When the switch is omitted, the script will use $VUFIND_LOCAL_DIR/import/import.properties if it exists and $VUFIND_HOME/import/import.properties otherwise.

Configuring Index Specification Files

SolrMarc loads index specification files based on the “solr.indexer.properties” setting in its configuration file. In VuFind, the default value for this setting is “marc.properties, marc_local.properties” – this means that marc.properties defines the default settings, but entries in marc_local.properties will take precedence and override the equivalent settings from marc.properties.

You can include any number of comma-separated filenames here, and they will all be chained together, with later files overriding settings from earlier files.

The solrmarc.path setting lists the directories where SolrMarc will search for the specified filenames; when VuFind's default configuration is being used, it will first look in $VUFIND_LOCAL_DIR/import, and then in $VUFIND_HOME/import.

Example: Putting It All Together

Suppose you have two files: library1.mrc and library2.mrc. When you index library1.mrc, you want to set the Institution facet to “Library 1,” and when you index library2.mrc, you want to set the Institution facet to “Library 2.” You can meet this goal by following these steps:

Step 1: Create the Indexing Specification Files

You'll need to create an indexing specification file for each institution, like this:

$VUFIND_LOCAL_DIR/import/marc_library1.properties:

institution = "Library 1"

$VUFIND_LOCAL_DIR/import/marc_library2.properties:

institution = "Library 2"

Step 2: Create SolrMarc Configuration Files Pointing to the Index Specification Files

You need a separate SolrMarc configuration for each library that is set up to load the appropriate index specification file. You can create two copies of $VUFIND_LOCAL_DIR/import/import.properties, and edit each one to customize the solr.indexer.properties setting appropriately.

$VUFIND_LOCAL_DIR/import/import_library1.properties:

...
solr.indexer.properties = marc.properties, marc_local.properties, marc_library1.properties
...

$VUFIND_LOCAL_DIR/import/import_library2.properties:

...
solr.indexer.properties = marc.properties, marc_local.properties, marc_library2.properties
...

Step 3: Run the Indexing Process

Now you simply need to use the -p switch to specify the correct configuration for each MARC file:

cd $VUFIND_HOME
./import-marc.sh -p $VUFIND_LOCAL_DIR/import/import_library1.properties library1.mrc
./import-marc.sh -p $VUFIND_LOCAL_DIR/import/import_library2.properties library2.mrc
indexing/marc/multiple_configs.txt · Last modified: 2020/10/12 20:58 by demiankatz