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.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
indexing:adding_facets [2015/12/14 17:12] – ↷ Links adapted because of a move operation demiankatz | indexing:adding_facets [2021/03/24 15:47] (current) – [Index field does not exist, translation needed] emaijala | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Facets ====== | + | ====== |
- | //These directions are based on the excellent documentation provided by the [[http:// | + | //These directions are based on the excellent documentation provided by the [[http:// |
- | Adding a facet to the Narrow Search box is a relatively straightforward procedure. | + | Adding a facet to the Narrow Search box is a relatively straightforward procedure. |
- | 1. The index to be used already exists | + | 1. The index field to be used already exists |
- | 2. No index currently exists; the data in the MARC record will be indexed directly (i.e. data is already a text string with no need or desire for normalization) | + | 2. No index field currently exists; the data in the MARC record will be indexed directly (i.e. data is already a text string with no need or desire for normalization) |
- | 3. No index currently exists; data is encoded and will need to be translated into text strings first | + | 3. No index field currently exists; data is encoded and will need to be translated into text strings first |
- | ===== Index exists ===== | + | ===== Index field exists ===== |
//Example used: Adding the date of publication as a facet// | //Example used: Adding the date of publication as a facet// | ||
- | First verify existence of the index and make sure it contains the data you want. / | + | First verify existence of the index field and make sure it contains the data you want. |
In our example, the publishDate index is a custom index not pulled directly from a MARC tag. The DateOfPublication custom indexing routine provided the date to the indexer, but we do not need to know how it does that to proceed. | In our example, the publishDate index is a custom index not pulled directly from a MARC tag. The DateOfPublication custom indexing routine provided the date to the indexer, but we do not need to know how it does that to proceed. | ||
- | The file [[: | + | The file [[configuration: |
| | ||
Line 32: | Line 32: | ||
That's it. Changes are immediately reflected on the search results page. | That's it. Changes are immediately reflected on the search results page. | ||
- | If, due to typos, etc, a non-existent index is added to the list, this will break the Narrow Search box completely and no facets | + | If, due to typos, etc, a non-existent index field is added to the list, this may break the Narrow Search box completely and prevent |
- | ===== Index does not exist, no translation needed ===== | + | ===== Index field does not exist, no translation needed ===== |
//Example: a customized genre facet based on the genre heading fields and subfields// | //Example: a customized genre facet based on the genre heading fields and subfields// | ||
- | If the desired facet is not already an existing index, we must first create the index. This will require re-indexing of the entire database. | + | If the desired facet is not already an existing index field, we must first create the field. This will require re-indexing of all of your records. |
- | The file / | + | The file $VUFIND_HOME/ |
In this example, we want to use the strings found in the 655 subfield a, and the subfield v data from the 650, 651, and 600 fields. | In this example, we want to use the strings found in the 655 subfield a, and the subfield v data from the 650, 651, and 600 fields. | ||
Line 46: | Line 46: | ||
| | ||
- | We now need to tell Solr what to do with the new index. | + | We now need to tell Solr what to do with the new index. |
<field name=" | <field name=" | ||
- | After the database has been re-indexed, the allgenre index will exist. | + | After the database has been re-indexed, the allgenre index field will exist. |
==== A Useful Shortcut -- Dynamic Fields ==== | ==== A Useful Shortcut -- Dynamic Fields ==== | ||
Line 58: | Line 58: | ||
See [[development: | See [[development: | ||
- | ===== Index does not exist, translation needed ===== | + | ==== A Best Practice -- Local Settings Directory ==== |
+ | |||
+ | While the example above suggests editing marc.properties directly, VuFind 2.0 and later supports a [[configuration: | ||
+ | |||
+ | See [[indexing: | ||
+ | |||
+ | ===== Index field does not exist, translation needed ===== | ||
//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. | + | For encoded data (such as data found in the 007, 008, or several 04X fields), we must first map the data to text strings. |
- | Create a text file in import/solrmarc | + | ==== Mapping values during indexing ==== |
+ | |||
+ | Create a text file in $VUFIND_LOCAL_DIR/ | ||
ka = Piano | ka = Piano | ||
Line 73: | Line 81: | ||
Etc. | Etc. | ||
- | In import/ | + | In $VUFIND_HOME/ |
| | ||
Line 79: | Line 87: | ||
Of note: The numbers in brackets indicate that the system should look at only the first two bytes in the 048 subfield a field (0-1 mean position 0 to position 1). A comma separates the field information from the name of the file used to translate the data, in this case, instrument_map.properties. | Of note: The numbers in brackets indicate that the system should look at only the first two bytes in the 048 subfield a field (0-1 mean position 0 to position 1). A comma separates the field information from the name of the file used to translate the data, in this case, instrument_map.properties. | ||
- | A line defining the new index must be added to Solr's schema.xml file (found in solr/ | + | A line defining the new index field must be added to Solr's schema.xml file (usually |
+ | |||
+ | ==== 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' | ||
+ | |||
+ | 1. Add the facets to translated_facets[] setting in $VUFIND_LOCAL_DIR/ | ||
+ | < | ||
+ | [Advanced_Settings] | ||
+ | translated_facets[] = institution: | ||
+ | translated_facets[] = building: | ||
+ | </ | ||
+ | 2. Add translations for institution facet to $VUFIND_LOCAL_DIR/ | ||
+ | < | ||
+ | CPL = " | ||
+ | </ | ||
+ | 3. Add translations for building facet to $VUFIND_LOCAL_DIR/ | ||
+ | < | ||
+ | AV = " | ||
+ | GEN = " | ||
+ | </ | ||
+ | |||
+ | ===== Troubleshooting ===== | ||
+ | |||
+ | ==== string vs. text fields ==== | ||
+ | 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 " | ||
---- struct data ---- | ---- struct data ---- | ||
+ | properties.Page Owner : | ||
---- | ---- | ||
indexing/adding_facets.1450113155.txt.gz · Last modified: 2015/12/14 17:12 by demiankatz