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

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
indexing:adding_facets [2018/05/11 11:28] demiankatzindexing:adding_facets [2021/03/24 15:47] (current) – [Index field does not exist, translation needed] emaijala
Line 68: Line 68:
 //Example: Instrument types for music// //Example: Instrument types for music//
  
-For encoded data (such as data found in the 007, 008, or several 04X fields), we must first map the data to text strings.  Luckily, the MARC format is well documented and lists of what each code means are readily available on the [[http://www.loc.gov/marc/marcdocz.html|MARC Code Lists]] and at OCLC's [[http://www.oclc.org/bibformats/en/|Formats and Standards page]].+For encoded data (such as data found in the 007, 008, or several 04X fields), we must first map the data to text strings. If the language translation system is used, the values can also be indexed without mapping (see below). Luckily, the MARC format is well documented and lists of what each code means are readily available on the [[http://www.loc.gov/marc/marcdocz.html|MARC Code Lists]] and at OCLC's [[http://www.oclc.org/bibformats/en/|Formats and Standards page]]. 
 + 
 +==== Mapping values during indexing ====
  
 Create a text file in $VUFIND_LOCAL_DIR/import/translation_maps and name it "something.properties". In this case, I have created the file $VUFIND_LOCAL_DIR/import/translation_maps/instrument_map.properties to contain the mapping.  The file will translate the two-letter codes used in the MARC 048 field into readable text.  Each line of the file contains a single possible code and its translation. Example: Create a text file in $VUFIND_LOCAL_DIR/import/translation_maps and name it "something.properties". In this case, I have created the file $VUFIND_LOCAL_DIR/import/translation_maps/instrument_map.properties to contain the mapping.  The file will translate the two-letter codes used in the MARC 048 field into readable text.  Each line of the file contains a single possible code and its translation. Example:
Line 86: Line 88:
  
 A line defining the new index field must be added to Solr's schema.xml file (usually found in $VUFIND_HOME/solr/vufind/biblio/conf) and a line for the new facet will be added to [[configuration:files:facets.ini]] (see above for instructions). A line defining the new index field must be added to Solr's schema.xml file (usually found in $VUFIND_HOME/solr/vufind/biblio/conf) and a line for the new facet will be added to [[configuration:files:facets.ini]] (see above for instructions).
 +
 +==== Translating values with the language translation system ====
 +
 +Strings in facet fields can be translated to user-friendly form and/or to different languages using VuFind's translation support. Steps needed to enable traslation of institution and building facets:
 +
 +1. Add the facets to translated_facets[] setting in $VUFIND_LOCAL_DIR/config/vufind/[[configuration:files:facets.ini]]. Using namespaces as below is recommended so that any values in different facet fields or other translations don't overlap:
 +<code>
 +[Advanced_Settings]
 +translated_facets[] = institution:institution
 +translated_facets[] = building:building
 +</code>
 +2. Add translations for institution facet to $VUFIND_LOCAL_DIR/languages/institution/en.ini:
 +<code>
 +CPL = "Centerville Library"
 +</code>
 +3. Add translations for building facet to $VUFIND_LOCAL_DIR/languages/building/en.ini:
 +<code>
 +AV = "Audiovisual"
 +GEN = "General Stacks"
 +</code>
  
 ===== Troubleshooting ===== ===== Troubleshooting =====
Line 93: Line 115:
 If you set up a facet field and see individual words instead of complete facet values, this most likely means that you have faceted on an analyzed field (usually of type "text" in [[development:architecture:solr_index_schema|VuFind's Solr schema]]). Solr faceting displays the terms stored in the index, not the original raw text provided at index-time. Thus, if you facet on an analyzed field that tokenizes and manipulates strings, strange facet values may appear to the end user. Most of the time, you only want to facet on simple string fields to avoid this problem. This is why the default schema includes some apparently duplicate values -- it is generally necessary to use different fields for search-oriented and facet-oriented tasks. If you set up a facet field and see individual words instead of complete facet values, this most likely means that you have faceted on an analyzed field (usually of type "text" in [[development:architecture:solr_index_schema|VuFind's Solr schema]]). Solr faceting displays the terms stored in the index, not the original raw text provided at index-time. Thus, if you facet on an analyzed field that tokenizes and manipulates strings, strange facet values may appear to the end user. Most of the time, you only want to facet on simple string fields to avoid this problem. This is why the default schema includes some apparently duplicate values -- it is generally necessary to use different fields for search-oriented and facet-oriented tasks.
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
indexing/adding_facets.1526038134.txt.gz · Last modified: 2018/05/11 11:28 by demiankatz