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

This is an old revision of the document!


Hierarchies and Collections

The features described on this page are available starting with VuFind 1.4.

Hierarchies

Some document collections are structured hierarchically. VuFind offers a mechanism for displaying these hierarchies as a pop-up within search results and as a tab of the record page.

Solr Setup

To display hierarchies, VuFind needs to be able to find information about document relationships in your Solr index. At index time, you need to populate the following fields in order to use hierarchy functionality:

  • hierarchytype - The type of hierarchy being used (this triggers loading of a hierarchy driver; it is usually easiest to leave it blank, causing VuFind to default to the driver specified in the [Hierarchy] section of config.ini).
  • hierarchy_top_id - The Solr ID of the record representing the top of the hierarchy containing the current record.
    • This may be multi-valued if a record belongs to multiple collections.
  • hierarchy_top_title - The title of the record representing the top of the hierarchy containing the current record.
    • This may be multi-valued if a record belongs to multiple collections; the order of multiple values in this field must correspond with values in hierarchy_top_id.
  • hierarchy_parent_id - The Solr ID of the record immediately above the current record in the hierarchy.
    • This may be multi-valued in the case of multiple collection membership.
  • hierarchy_parent_title - The title of the record immediately above the current record in the hierarchy.
    • This may be multi-valued if a record belongs to multiple collections; the order of multiple values in this field must correspond with values in hierarchy_parent_id.
  • hierarchy_sequence - A value indicating the position of the current record relative to its siblings, used for sorting records when rendering trees.
    • This may be multi-valued if a record belongs to multiple collections; the order of multiple values in this field must correspond with values in hierarchy_parent_id.
    • Note that this is a string field, so sorting is done alphabetically rather than numerically – numeric values may need to be padded with zeroes to achieve appropriate sorting.
  • is_hierarchy_id - If the current record represents a node within a hierarchy, this field should contain the same value as the regular id field.
  • is_hierarchy_title - If the current record represents a node within a hierarchy, this field should contain the same value as the regular title field.

VuFind Configuration

Once the Solr index is populated appropriately, you need to adjust several VuFind configuration files to make hierarchies visible.

  • In config.ini, make sure that the [Hierarchy] section contains a driver setting (Default is usually the best option if you want to show trees) and the showTree setting is true.
  • In your hierarchy driver configuration file (usually HierarchyDefault.ini in the same directory as config.ini), make sure that appropriate values are set.
  • If you are using Solr to construct tree data, you may also want to set up util/createHierarchyTrees.php as a cron job or as part of your index process to ensure that your tree cache is always filled. This will prevent users from experiencing long waits while trees are constructed on demand. If using this approach, be sure your HierarchyDefault.ini has an appropriate solrCacheTime value set (probably -1, for no expiration, if you set things up so that the cache is always populated with appropriate data).
  • You can optionally enable or disable searching within trees (a search causes items within the tree to highlight if they match the query); this is on by default and can be controlled within the [Hierarchy] section of config.ini.

Collections

Once you have hierarchies set up, you have the option of enabling VuFind's Collection module. This can be used to provide an alternative to the standard record view for records that are considered “collections”. This allows you to, for example, view and search a list of items below the collection record's position in the hierarchy.

Configuration

To enable collections, set the collections setting in the [Collections] section of config.ini to true.

Further configuration options can be found in your hierarchy driver configuration file (usually HierarchyDefault.ini in the same folder as config.ini). The most important option here is link_type in the [Collections] section. This controls which records are treated as collections rather than flat records. Three options are possible:

  • Top - Only records at the top of a hierarchy tree are treated as collections. All nodes below the top are “flattened” into a single result list within the collection.
  • All - Any record marked as a node within the hierarchy (i.e. with is_hierarchy_id set in the Solr index) will be treated as a collection. When viewing the collection, only records immediately beneath this node will be visible, allowing a more granular exploration of the hierarchy.
  • None - This disables collections for all records using this hierarchy driver. If you only have one hierarchy driver (the most common situation), it is easier to turn off collections globally in config.ini. This setting exists in case it is needed in more complex multi-driver scenarios.
indexing/hierarchies_and_collections.1355512030.txt.gz · Last modified: 2014/06/13 13:12 (external edit)