1.8 Multiple Goobi viewer

General

If two or more Goobi viewer instances are to be supplied from one Goobi workflow, various requirements must be met. This section describes how to configure common questions for Goobi workflow and Goobi viewer.

Capturing and evaluating the instance

Goobi workflow

In Goobi workflow, the instance in which the work is to be displayed must be entered. To do this, a new ViewerInstance metadata must be added in the rule set. This is then also added to DocStructs that had the CatalogIDDigital metadatum configured as a mandatory metadatum.

The relevant parts from the rule set are:

<MetadataType>
    <Name>ViewerInstance</Name>
    <language name="de">Anzeige in</language>
    <language name="en">Show in</language>
</MetadataType>

<!-- [...] -->
<metadata num="1o" DefaultDisplay="true">ViewerInstance</metadata>

<!-- [...] -->

<NamespaceDefinition>
    <URI>https://intranda.com/MODS/</URI>
    <prefix>intranda</prefix>
</NamespaceDefinition>

<!-- [...] -->

<Metadata>
    <InternalName>ViewerInstance</InternalName>
    <WriteXPath>./mods:mods/mods:extension/#intranda:viewerinstance</WriteXPath>
</Metadata>

In the configuration file goobi_metadataDisplayRules.xml a drop-down menu with the desired Goobi viewer instances is assigned:

<context projectName="*">
    <select1 ref="ViewerInstance">
        <item selected="true">
            <label>Viewer 1</label>
            <value>viewer1</value>
        </item>
        <item selected="false">
            <label>Viewer 2</label>
            <value>viewer2</value>
        </item>
        <item selected="false">
            <label>Viewer 3</label>
            <value>viewer3</value>
        </item>
        <item selected="false">
            <label>Viewer 1 and Viewer 2</label>
            <value>viewer1_and_viewer2</value>
        </item>
        <item selected="false">
            <label>Viewer 1 and Viewer 3</label>
            <value>viewer1_and_viewer3</value>
        </item>
        <item selected="false">
            <label>Viewer 2 and Viewer 3</label>
            <value>viewer2_and_viewer3</value>
        </item>
        <item selected="false">
            <label>All instances</label>
            <value>all</value>
        </item>
    </select1>
</context>

Goobi viewer Indexer

The metadatum ViewerInstance is written into a separate field within the Solr Index. For this, the following field definition must be added in the config_indexer.xml configuration file:

<init>
    <namespaces>
        <list>
            <intranda>https://intranda.com/MODS/</intranda>
        </list>
    </namespaces>
<init>

<!-- [...] -->

<fields>
    <MD2_VIEWERINSTANCE>
        <list>
            <item>
                <xpath>mets:xmlData/mods:mods/mods:extension/intranda:viewerinstance</xpath>
                <addToDefault>false</addToDefault>
                <addUntokenizedVersion>false</addUntokenizedVersion>
                <addToChildren>true</addToChildren>
                <addToPages>true</addToPages>
            </item>
        </list>
    </MD2_VIEWERINSTANCE>
</fields>

With addToChildren=true and addToPages=true it is ensured that metadata in sub-elements and pages can still be searched for if the instance restriction is set.

Goobi viewer Core

For each Goobi viewer instance, a staticQuerySuffix must now be defined, specifying which condition must be met for works to be displayed:

<search>
    <staticQuerySuffix>+(MD2_VIEWERINSTANCE:viewer1 MD2_VIEWERINSTANCE:viewer1_and_viewer2 MD2_VIEWERINSTANCE:viewer1_and_viewer3 MD2_VIEWERINSTANCE:all)</staticQuerySuffix>
</search>

The + stands for an "AND". The brackets summarise everything inside. If conditions are not explicitly linked within a query, this automatically corresponds to an "OR".

Capture and display individual collections

Goobi workflow

In order to enter individual collections per Goobi viewer instance, these must be entered as metadata. To do this, a new metadatum is added in the rule set for each instance. The relevant parts for another collection tree from the rule set are:

<MetadataType>
    <Name>Viewer2Collection</Name>
    <language name="de">Viewer 2 Kollektion</language>
    <language name="en">Viewer 2 collection</language>
</MetadataType>

<!-- [...] -->

<metadata num="*">Viewer2Collection</metadata>

<!-- [...] -->

<Metadata>
    <InternalName>Viewer2Collection</InternalName>
    <WriteXPath>./mods:mods/#mods:classification[@authority='z']</WriteXPath>
</Metadata>

If required, a drop-down menu with predefined collection names and values can be defined in goobi_metadataDisplayRules.xml.

Goobi viewer Indexer

First, the exported collections must be written into a separate field within the Solr index. To do this, the following field definition must be added to the config_indexer.xml configuration file:

<fields>
    <MD2_DC_VIEWER2>
        <list>
            <item>
                <xpath>mets:xmlData/mods:mods/mods:classification[@authority='z']</xpath>
                <getparents>all</getparents>
                <onetoken>true</onetoken>
                <onefield>false</onefield>
                <urlEncoding>false</urlEncoding>
                <addToDefault>false</addToDefault>
                <splittingCharacter>#</splittingCharacter>
                <addUntokenizedVersion>false</addUntokenizedVersion>
                <lowercase>true</lowercase>
                <addToChildren>true</addToChildren>
                <addToPages>true</addToPages>
            </item>
        </list>
    </MD2_DC_VIEWER2>
</fields>

Goobi viewer Core

This field must now be configured in the local config_viewer.xml instead of the usual DC field. For example:

<!-- Show MD2_DC_VIEWER2 instead of DC as collection field at the metadata page -->
<metadata>
    <mainMetadataList>
        <template name="_DEFAULT">
            <metadata label="MD2_DC_VIEWER2" value="">
                <param type="translatedfield" key="MD2_DC_VIEWER2_UNTOKENIZED" />
            </metadata>
        </template>
    </mainMetadataList>
</metadata>

<!-- Use MD2_DC_VIEWER2 instead of DC for facetting and in advanced search -->
<search>
    <facets>
        <field initialElementNumber="3">YEAR</field>
        <hierarchicalField initialElementNumber="3">MD2_DC_VIEWER2</hierarchicalField>
        <field initialElementNumber="3">DOCSTRCT_TOP</field>
        <field initialElementNumber="3">DOCSTRCT_SUB</field>
        <field initialElementNumber="3" sortOrder="alphabetical_asc">MD_PLACEPUBLISH</field>
    </facets>
    
    <advanced>
        <searchFields>
            <field>DEFAULT</field>
            <field>FULLTEXT</field>
            <field>CMS_TEXT_ALL</field>
            <field>PI_TOPSTRUCT</field>
            <field hierarchical="true">MD2_DC_VIEWER2</field>
            <field>DOCSTRCT_TOP</field>
            <field>DOCSTRCT_SUB</field>
            <field>MD_TITLE</field>
            <field>MD_CREATOR</field>
            <field>MD_PUBLISHER</field>
            <field>MD_PLACEPUBLISH</field>
            <field>MD_YEARPUBLISH</field>
            <field untokenizeForPhraseSearch="true">MD_SHELFMARK</field>
        </searchFields>
    </advanced>
</search>

<!-- Additional configuration such as for the breadcrumbs for MD_DC_VIEWER2 -->
<collections>
    <collection field="MD2_DC_VIEWER2">
        <addHierarchyToBreadcrumbs>true</addHierarchyToBreadcrumbs>
    </collection>
    <redirectToWork>false</redirectToWork>
</collections>

In addition, the field name must of course be translated accordingly in the messages files. For example:

MD2_DC_VIEWER2=Sammlung

Goobi viewer Backend

To display a collection page with its own tree, a new CMS page must now be created in the Goobi viewer backend based on the "Collection display" template, configured as an overwritten static page and linked in the menu:

Last updated