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:solrmarc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
indexing:solrmarc [2016/12/16 13:51] – [SolrMarc] demiankatzindexing:solrmarc [2020/09/22 14:31] demiankatz
Line 3: Line 3:
 [[https://github.com/solrmarc/solrmarc|SolrMarc]] is used to import MARC metadata to the "biblio" index on Solr used by VuFind.  See [[development:architecture:solr_index_schema|Solr Index Schema]] for notes on the layout of the index. [[https://github.com/solrmarc/solrmarc|SolrMarc]] is used to import MARC metadata to the "biblio" index on Solr used by VuFind.  See [[development:architecture:solr_index_schema|Solr Index Schema]] for notes on the layout of the index.
  
-===== Upgrading SolrMarc =====+===== SolrMarc Versions =====
  
-There should rarely be a need to do so, but if you wish, you can update to the latest version of the tool, available [[http://code.google.com/p/solrmarc/|here]] Instructions on setting up SolrMarc with VuFind are available [[http://code.google.com/p/solrmarc/wiki/VufindHowTo|here]].+VuFind's [[:changelog|changelog]] can help you determine which version of SolrMarc you are currently running. 
 + 
 +:!: Prior to VuFind 3.1, SolrMarc 2.x was used. With the introduction of SolrMarc 3.xmany performance benefits and enhanced features became available. 
 + 
 +Users are strongly encouraged to upgrade to VuFind 3.1 or later in order to take advantage of the improved indexing toolManually installing the new SolrMarc in an earlier version of VuFind should also be possible with relatively minimal work by replacing the necessary .jar files and adapting the revised indexing scripts found in later releases. 
 + 
 +Manually upgrading SolrMarc to a later 3.x version is simply a matter of updating import/solrmarc-core.jar and any necessary dependencies found in import/lib.
 ===== Customizing Import Mappings ===== ===== Customizing Import Mappings =====
  
-The import process is controlled by the settings in the import/marc.properties file under your VuFind installation directory.  The default settings should be fine for a first-time user, but if you want to change or expand the set of MARC fields that are used to build VuFind's search indexes, you can edit this file to make adjustments.  See the [[http://code.google.com/p/solrmarc/wiki/ConfiguringSolrMarc|SolrMarc documentation]] for details on how this works.+The import process is controlled by the settings in the import/marc.properties file under your VuFind installation directory.  The default settings should be fine for a first-time user, but if you want to change or expand the set of MARC fields that are used to build VuFind's search indexes, you can edit this file to make adjustments.  See the [[https://github.com/solrmarc/solrmarc/wiki|SolrMarc documentation]] for details on how this works.
  
 As of VuFind 1.0RC2, a second properties file is also available called import/marc_local.properties.  Any lines added to this file will override the equivalent settings in marc.properties.  Use of this file is optional, but it is an easy way to separate your local customizations from the default settings packaged with VuFind.  For more details, see [[indexing:solrmarc:local_marc_mappings|local MARC mappings]]. As of VuFind 1.0RC2, a second properties file is also available called import/marc_local.properties.  Any lines added to this file will override the equivalent settings in marc.properties.  Use of this file is optional, but it is an easy way to separate your local customizations from the default settings packaged with VuFind.  For more details, see [[indexing:solrmarc:local_marc_mappings|local MARC mappings]].
Line 18: Line 24:
 ===== Customizing Translation Maps ===== ===== Customizing Translation Maps =====
  
-One of the features of SolrMarc is the ability to translate values found in MARC into different strings using translation map files (i.e. language_map.properties).  See the [[http://code.google.com/p/solrmarc/wiki/ConfiguringSolrMarc|SolrMarc documentation]] for details on how to specify a translation map in the marc.properties file.+One of the features of SolrMarc is the ability to translate values found in MARC into different strings using translation map files (i.e. language_map.properties).  See the [[https://github.com/solrmarc/solrmarc/wiki/Translation-maps|SolrMarc documentation]] for details on how to specify a translation map in the marc.properties file.
  
 Starting with VuFind 1.0RC2, translation maps are found in the import/translation_maps directory. Starting with VuFind 1.0RC2, translation maps are found in the import/translation_maps directory.
 +
 +Starting with VuFind 2.x, translation maps can be overridden in the [[configuration:local_settings_directory|local settings directory]].
  
 Prior to RC2, translation maps are embedded in the SolrMarc .jar file, making them more difficult (but certainly not impossible) to modify. Prior to RC2, translation maps are embedded in the SolrMarc .jar file, making them more difficult (but certainly not impossible) to modify.
Line 26: Line 34:
 ===== Customizing Format Determination ===== ===== Customizing Format Determination =====
  
-One of the most commonly-requested VuFind customizations involves changing the way record formats are assigned.+One of the most commonly-requested VuFind customizations involves changing the way record formats are assigned. The method for this depends on your VuFind version. 
 + 
 +==== VuFind 6.0 and newer ==== 
 + 
 +VuFind 6.0 replaces the getFormat method with getFormats (to return multiple values when appropriate). The advice below for VuFind 4.0 and newer remains relevant; just be sure to override the appropriate method. 
 + 
 +==== VuFind 4.0 and newer ==== 
 + 
 +More recent versions of VuFind determine formats using a getFormat function found in [[https://github.com/vufind-org/vufind/blob/dev/import/index_java/src/org/vufind/index/FormatCalculator.java|FormatCalculator.java]]. You can override this file in your [[configuration:local_settings_directory|local settings directory]] to adjust the behavior. 
 + 
 +  - Copy import/index_java/src/org/vufind/index/FormatCalculator.java into the import/index_java/src/edu/myuniversity/index (replacing edu/myuniversity with an appropriate domain for your institution) subdirectory of your [[configuration:local_settings_directory|local settings directory]] and edit it to customize the behavior as needed.  Be sure to adjust the package declaration at the top of the file to match the directory path you created, so you can differentiate your local indexing class from the core one. The MARC access is accomplished with the [[http://marc4j.tigris.org/|MARC4J]] library. 
 +  - If your new custom script returns different values than the old script, or if you want to change the way the existing values are mapped into your index, edit a local copy of the translation map found in import/translation_maps/format_map.properties. 
 +  - If SolrMarc has difficulty finding your custom code, you can edit a local copy of import/marc_local.properties to ensure that VuFind loads the appropriate class. This could look like: 
 + 
 +  format = custom(edu.myuniversity.index.FormatCalculator), getFormat, format_map.properties 
 + 
 +==== VuFind 3.x and earlier ====
  
-By default, formats are generated using the getFormat function built into SolrMarc.  However, the logic used by getFormat is also replicated in a BeanShell script packaged with VuFind.  If you want to customize the behavior, here are the steps to follow:+By default, formats are generated in older versions of VuFind using the getFormat function built into SolrMarc.  However, the logic used by getFormat is also replicated in a BeanShell script packaged with VuFind.  If you want to customize the behavior, here are the steps to follow:
  
   - Copy import/index_scripts/format.bsh into the import/index_scripts subdirectory of your [[configuration:local_settings_directory|local settings directory]] and edit it to customize the behavior as needed.  BeanShell borrows its syntax and libraries from Java, so the code should look familiar to many developers.  The MARC access is accomplished with the [[http://marc4j.tigris.org/|MARC4J]] library.   - Copy import/index_scripts/format.bsh into the import/index_scripts subdirectory of your [[configuration:local_settings_directory|local settings directory]] and edit it to customize the behavior as needed.  BeanShell borrows its syntax and libraries from Java, so the code should look familiar to many developers.  The MARC access is accomplished with the [[http://marc4j.tigris.org/|MARC4J]] library.
Line 36: Line 60:
 ===== Custom Indexing Functions ===== ===== Custom Indexing Functions =====
  
 +==== Dynamically-Compiled Java Code ====
 +
 +:!: This option is only available in SolrMarc 3.0 and later, but it is usually the preferred option when available. The other three options below are more relevant to SolrMarc 2.x and earlier, and the documentation links they provide may be outdated.
 +
 +By putting custom Java code in the import/index_java/src subdirectory (either under $VUFIND_HOME or in your [[configuration:local_settings_directory|local settings directory]]), you can define custom methods that will be automatically compiled at runtime. This offers the benefits of BeanShell scripting with none of the disadvantages. See [[https://github.com/solrmarc/solrmarc/wiki/Compile-User-supplied-Custom-Methods-at-Runtime|the documentation]] for more details.
 +
 +See [[indexing:solrmarc:custom_java_best_practices|Custom Java Best Practices]] for some suggestions.
 ==== Compiled Custom Functions ==== ==== Compiled Custom Functions ====
  
Line 62: Line 93:
  
 (just replace "bib_" in the second line with the prefix you desire). (just replace "bib_" in the second line with the prefix you desire).
- 
-Here is the [[http://old.nabble.com/FW%3A--solrmarc-tech--RE%3A-constructing-a-custom-id-field-in-marc.properties-p31334509.html|original thread]] from which this trick was derived. 
- 
  
 ===== Pre-Processing Records ===== ===== Pre-Processing Records =====
indexing/solrmarc.txt · Last modified: 2024/02/23 11:34 by demiankatz