1.17.2 Faceting
The search hits are automatically faceted. The configuration is as follows:
config_viewer.xml
<search>
<facets>
<field>YEAR</field>
<geoField predicate="IsWithin" displayResultsOnMap="true">WKT_COORDS</geoField>
<hierarchicalField initialElementNumber="4">DC</hierarchicalField>
<field initialElementNumber="3">DOCSTRCT_TOP</field>
<field initialElementNumber="3">DOCSTRCT_SUB</field>
<field initialElementNumber="3" sortOrder="alphabetical_asc">MD_CREATOR </field>
<field initialElementNumber="3" priorityValues="Berlin;Göttingen">MD_PLACEPUBLISH </field>
<field labelField="MD_LABEL">MD_LOCATION</field>
<field translateLabels="false">MD_OTHERVALUE</field>
</facets>
</search>
Any number of additional index fields for faceting can be defined via <field> elements. Please note that fields with the prefix FACET_ should exist in the index for this purpose, as these are processed more efficiently due to your configuration. Fields with the prefix FACET_ are automatically generated during indexing for all MD_* fields and for DC, DOCSTRCT, CENTURY and YEAR. Configured should still be the regular field names - the special faceting fields are used internally automatically.
The attribute labelField can contain an index field for label values that differs from the faceting field. For example, grouped metadata containing different names of a city (e.g. "Instanbul" and "Constantinople") can be facetted using a common standard value (e.g. a URI). A value composed of the different names is displayed to the user, and the faceting is done using the standard value.
The attribute translateLabels controls whether listed labels of the facets are to be translated by the messages files. This functionality is active by default and can optionally be switched off.
The fields DOCSTRCT_TOP (document type) and DOCSTRCT_SUB (structure element) are generated automatically.
Fields that are searched hierarchically (for example DC) should be configured as <hierarchicalField>. The attribute initialElementNumber="" defines the number of faceting values initially displayed after a search. All others are displayed by expanding the respective faceting element.). The attribute sortOrder="" can be used to set the initial sorting within the faceting. Possible values are alphabetical_asc, alphabetical_desc, numerical_asc and numerical_desc. If no sortOrder is set, the hits are automatically sorted by occurrence in descending order. The order in the configuration file reflects the order in the interface.
In the attribute priorityValues, (semicolon-separated) values can be specified which should always be sorted on top if these values occur, independent of the other sorting of the faceting values.
If the YEAR field is defined, it is displayed in the form of a slider in the interface.
If a <geoField> is configured, it must have the value WKT_COORDS, the field through which a geospatial search can be performed in SOLR. Then a map widget will be displayed for each search, through which the search results can be faceted by geographic areas. If there are search results with geographical coordinates, they are displayed in a map above the search results list, too. The attribute displayResultsOnMap can be used to control whether markers are displayed in the map widget for all search hits with geo-coordinates. The default is true.
The <geoField> element can also have a predicate attribute attached to it that describes how to search for matches within a range. There are three possible values:
  1. 1.
    IsWithin: Finds only hits whose all objects contained in WKT_COORDS - points or polygons - are completely within the search range. This is the default value.
  2. 2.
    Intersects: Finds all matches of which at least one object contained in WKT_COORDS somehow intersects the search range.
  3. 3.
    Contains: Finds all hits that contain at least one polygon in WKT_COORDS that completely contains the search range.
Copy link