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

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
indexing:koha [2016/01/20 14:35] – [The Koha ILS Driver] demiankatzindexing:koha [2023/11/28 19:22] (current) demiankatz
Line 1: Line 1:
-====== How to index Koha with VuFind ======+====== How to index Koha with VuFind® ======
  
-This is how one university in Africa set up VuFind to index Koha.+These are general instructions for setting up indexing of bibliographic records from Koha into VuFind®'s Solr index. 
 + 
 +Koha uses an [[https://vufind.org/wiki/development:plugins:ils_drivers|ILS driver]] to connect the records with their holdings and status information.  You still need to manually import the MARC data from Koha, so VuFind® has the records that can be searched.  Once those records are there, VuFind® can determine the real time status of the items using the ILS driver. 
 + 
 +VuFind® also supports fetching records from Koha using [[indexing:oai-pmh|OAI-PMH]]. It can be useful for automating regular index updates. If you decide to use OAI-PMH, you will also need to set it up in Koha using a [[https://tiketti.koha-suomi.fi/projects/koha-suomen-dokumentaatio/wiki/OAI-PMH-configuration|configuration file to include item information]] (see also the [[configuration:ils:examples:koha_export|Exporting Records from Koha]] page and the [[https://koha-community.org/manual/20.11/en/html/webservices.html#oai-pmh|Koha Manual]]). 
 + 
 +===== VuFind® Indexing Configuration ===== 
 + 
 +Start by configuring indexing settings in VuFind®. The default settings contain everything needed for a basic setup apart from location-related fields. 
 + 
 +There are several ways to index location-related fields. The first one is to put library and location to separate fields, but also a single hierarchical facet can be specified as shown further below. 
 + 
 +Using the export command described below, Koha will include MARC field 952 for each item (see [[https://wiki.koha-community.org/wiki/Holdings_data_fields_(9xx)|Koha's wiki]] for more information).  
 +These fields can be mapped to VuFind®'s facet fields. The values are typically codes that are not very user-friendly, and while you could translate them to user-readable strings in marc_local.properties, translating them with VuFind®'s translation mechanism allows more flexibility. See [[indexing:adding_facets#translating_values_with_the_language_translation_system|Adding Facets]] for more information. 
 + 
 +Copy your marc_local.properties from $VUFIND_HOME/import to the $VUFIND_LOCAL_DIR/import ([[configuration:local_settings_directory|local settings]]) directory. Make all the changes you need to this file. 
 + 
 +Example settings: 
 +<code> 
 +institution = 952b 
 +building = 952c 
 +collection = 9528 
 +id = 999c, first 
 +</code> 
 + 
 +The id = 999c is needed for Vufind to find Koha's biblionumbers properly.  The 'id =' field is not in every version of the marc_local.properties file, so you may need to add that manually.  This is the field that the IDs are stored in.  Koha and VuFind® use different fields by default (vufind = 001, koha = 999c). 
 + 
 +You can also set any of the index fields to static strings if desired, for example: 
 +<code> 
 +institution = "City Library" 
 +</code> 
 + 
 +==== Hierarchical Location Facet ==== 
 + 
 +You can combine library and location into a [[configuration:facets#hierarchical_facets|hierarchical facet]] that may be more user-friendly than separate fields in the eaxmple above. Instead of mapping institution and building separately, use the following lines in marc_local.properties: 
 + 
 +<code> 
 +building = 952b, (pattern_map.building_0), unique 
 +building += 952bc, join("/"), (pattern_map.building_1), unique 
 +pattern_map.building_0.pattern_0 = (.+)=>0/$1/ 
 +pattern_map.building_1.pattern_0 = (.+)=>1/$1/ 
 +</code> 
 + 
 +You'll need to tell VuFind® to handle the building field as a hierarchical one in $VUFIND_LOCAL_DIR/config/vufind/facets.ini: 
 + 
 +<code> 
 +[SpecialFacets] 
 +hierarchical[] = building 
 + 
 +[Advanced_Settings] 
 +translated_facets[] = building:building 
 +</code> 
 + 
 +Hierarchical facet values can be translated just like normal facet values, but you need to add translations for the different hierarchy levels. E.g. for library CPL's location FIC, you would add the following translations to $VUFIND_LOCAL_DIR/languages/building/en.ini: 
 + 
 +<code> 
 +0/CPL/ = "Centerville Public Library" 
 +1/CPL/FIC/ = "Fiction" 
 +</code> 
 +  
 + 
 +==== Suppressed Records ==== 
 + 
 +If you want to exclude suppressed records from display in VuFind®, you may need to add additional settings to your import configuration. Koha stores suppressed status in MARC field 942, subfield n. A value of "1" or "Y" in 942n indicates a suppressed record. Adding a line similar to this to your marc_local.properties may help: 
 + 
 +<code> 
 +suppressed_str = 942n ? ($n matches "[^1Y]*.*"), DeleteRecordIfFieldEmpty 
 +</code>
  
-Koha uses an [[https://vufind.org/wiki/development:plugins:ils_drivers|ILS driver]] to connect the records with their holdings and status information.  You still need to manually import the MARC data from Koha, so VuFind has the records.  But once those records are there, VuFind can determine the status of the items. 
  
 ===== Exporting Records From Koha ===== ===== Exporting Records From Koha =====
-Koha has a cgi-bin/tools/export.pl file which allows you to export to MARC format. 
  
-To run that manually, you will need to set the path for PERL5LIB (or whatever your perl lib variable is)and set the variable that points to the Koha configuration file.  They will look something like:+Koha has a misc/export_records.pl file which allows you to export to MARC format. 
 + 
 +To run the export script, you will need to enter a Koha shell for the instance (<instance> is the Koha instance name): 
 +<code> 
 +koha-shell <instance> 
 +</code> 
 + 
 +Alternatively, you can manually set the path for PERL5LIB (or whatever your perl lib variable is) and the variable that points to the Koha configuration file:
 <file> <file>
 export PERL5LIB=/usr/share/koha/lib:$PERL5LIB export PERL5LIB=/usr/share/koha/lib:$PERL5LIB
-export KOHA_CONF=/etc/koha/sites/library/koha-conf.xml+export KOHA_CONF=/etc/koha/sites/<instance>/koha-conf.xml
 </file> </file>
-To do the export, you will want to do something like this (the paths may differ)+ 
 +To do the export, you will want to do something like this (the paths may differ):
 <code> <code>
-/usr/share/koha/intranet/cgi-bin/tools/export.pl --filename=kohabibs.marc+/usr/share/koha/bin/export_records.pl --format marc --record-type bibs --filename kohabibs.mrc
 </code> </code>
  
-===== Importing Into VuFind ===== 
-Once you have exported the koha records, you will need to import the records into VuFind. 
  
-Copy your marc_local.properties from $VUFIND_HOME/import to the $VUFIND_LOCAL_DIR/import ([[configuration:local_settings_directory|local settings]]) directory.+===== Importing Into VuFind® =====
  
-Make the changes to this file that you need to +Once you have exported the koha records, you will need to import the records into VuFind®. 
-<code> + 
-#collection = "collection" +If necessarytransfer the file over so that VuFind® can find it
-institution = "My University" +
-#building = "Library A" +
-id = 999cfirst +
-</code> +
-Koha needs to use the id = 999c for Vufind to properly tie the two together.  The id= field is not in every version of the marc_local.properties fileso you may need to add that manually This is the field that the book IDs are stored in.  Koha and VuFind use different fields by default. (vufind = 001, koha = 999c) +
  
 Now you are ready to run the import: Now you are ready to run the import:
Line 36: Line 102:
 ./import-marc.sh [directory]/kohabibs.marc ./import-marc.sh [directory]/kohabibs.marc
 </code> </code>
 +
  
 ===== The Koha ILS Driver ===== ===== The Koha ILS Driver =====
 +
 +:!: // The example here describes the simple, database-driven Koha driver; newer VuFind® releases may include KohaILSDI and/or KohaRest drivers that implement additional functionality using APIs found in newer Koha versions. The **KohaRest driver is recommended** as it supports the widest range of functionality and does not require direct database connection. See KohaRest.ini configuration file for more information. //
 +
 You will need to change the $VUFIND_LOCAL_DIR/config/vufind/config.ini file to have  You will need to change the $VUFIND_LOCAL_DIR/config/vufind/config.ini file to have 
 <file> <file>
Line 44: Line 114:
 </file> </file>
  
-This will enable the Koha ILS driver.  But you will still need to configure it.  Copy the Koha.ini file from $VUFIND_HOME/config/vufind/Koha.ini to $VUFIND_LOCAL_DIR/config/vufind/Koha.ini (from the global directory to the VuFind [[configuration:local_settings_directory|local settings directory]]).+This will enable the Koha ILS driver.  But you will still need to configure it.  Copy the Koha.ini file from $VUFIND_HOME/config/vufind/Koha.ini to $VUFIND_LOCAL_DIR/config/vufind/Koha.ini (from the global directory to the VuFind® [[configuration:local_settings_directory|local settings directory]]).
  
 Change your Koha.ini file to reflect your site. Change your Koha.ini file to reflect your site.
Line 70: Line 140:
 It will prompt you for the password.  If it works, then you are fine.  If it fails, then you will need to verify the username / password / database with your system administrator. It will prompt you for the password.  If it works, then you are fine.  If it fails, then you will need to verify the username / password / database with your system administrator.
  
-Once you have your koha.ini file set up, [[administration:starting_and_stopping_solr|restart Solr]] and check to see that your Koha records show up, and that the holdings information shows up.+Once you have your koha.ini file set up, check to see that your Koha records show up, and that the holdings information shows up. 
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
-For Koha exporting troubleshooting, check out the Koha forums.+For Koha exporting troubleshooting, reach out to the [[https://koha-community.org/|Koha community]].
  
 For MARC import/export, look at the [[https://vufind.org/wiki/indexing:marc|page on marc import/export]] For MARC import/export, look at the [[https://vufind.org/wiki/indexing:marc|page on marc import/export]]
Line 79: Line 150:
 There is a page for [[https://vufind.org/wiki/configuration:ils:troubleshooting|ILS troubleshooting]] There is a page for [[https://vufind.org/wiki/configuration:ils:troubleshooting|ILS troubleshooting]]
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
indexing/koha.1453300518.txt.gz · Last modified: 2016/01/20 14:35 by demiankatz