sf_store

This bundle contains factories for three kinds of stores:

  1. SuggestStore
  2. DocumentStore
  3. FeatureDocumentStore (former SmartSearchStore)

The SuggestStore is required while typing a search term into a search box. It responds with a list of suggestions for this search term.

The DocumentStore is used for requesting all results matching a specific search expression.

The FeatureDocumentStore is used to request features from ArcGIS Map- and FeatureServers.

Configuration

Defining the store instances

In the app.json file you can configure any number of SuggestStore, DocumentStore and FeatureDocumentStore instances.

Each SuggestStore, DocumentStore and FeatureDocumentStore configuration must have the following properties:

Property Name Type Description
id String An identifier for the store. The value must be unique among all stores registered in the app.
target String The URL of the search service followed by the smart.finder core name, e.g. https://smartfinder-search/core0

Additionally, a SuggestStore must also have a title attribute.

Property Name Type Description
title String The title of the store as displayed in the select box.

Example for SuggestStore and DocumentStore

Here is an example for a complete store configuration:

"sf_store": {
"SuggestStore": [
{
"id": "core0_suggest_store",
"title": "smart.finder Suchindex",
"target": "https://example.com/smartfinder-search/core0"
},
{
"id": "isoCore_suggest_store",
"title": "smart.finder SDI Suchindex",
"target": "https://example.com/smartfinder-search/iso"
}
],
"DocumentStore": [
{
"id": "core0_store",
"target": "https://example.com/smartfinder-search/core0"
},
{
"id": "isoCore_store",
"target": "https://example.com/smartfinder-search/iso"
}
]
}

How is a SuggestStore connected to a DocumentStore?

When a search term is typed into the search box, the SuggestStore is queried for suggestions. Once the user selects one of these suggestions, the corresponding DocumentStore is queried with that suggestion.

But how does smart.finder know the correct DocumentStore for a given SuggestStore? For this, the URLs of the stores are examined. The part after the last slash (/) character is the core name. SuggestStores and DocumentStores with equal core names belong together.

Example for FeatureDocumentStore

For a FeatureDocumentStore you don't need a SuggestStore configuration. It queries the select endpoint of solr directly. Here is an example for a complete store configuration:

"sf_store": {
"FeatureDocumentStore": [
{
"id": "feature_store",
"target": "https://example.com/smartfinder-search/featuresearch"
}
]
}

Configuring query templates for stores

Optionally you can configure a query template for each DocumentStore and FeatureDocumentStore to define your own Solr query.

For information how to define templates see: smart.finder - Query templates

Property Name Type Description
queryTemplate String A template that will be used to transform queries to the Solr backend.

Default queryTemplate values:

Store type Default value
DocumentStore {$field}:{$value}
FeatureDocumentStore {$field}:(({$value.split(' ').suffix('~1').join('OR')}) OR ({$value.split(' ').suffix('*^98').join('OR')}) OR (({$value})^100))

You can define the attributes that are displayed in the filter on the left hand side of the results page.

You can configure the attribute filter for each smart.finder core separately. In your app.json file look for the DocumentStore instance that points to the desired smart.finder core. Then edit the facetFields property and list the fields you wish to appear in the filter.

Property Name Type Description
facetFields Array<String> A list of field names you wish to appear in the attribute filter.

Example:

"sf_store": {
"SuggestStore": [
...
],
"DocumentStore": [
{
"id": "core0_store",
"target": "https://example.com/smartfinder-search/core0",
"facetFields": ["publisher", "language", "type", "format", "accessRights"],
},
...
]
}

Configuring the spatial reference system for data with geometry

Usually each metadata record has a certain geometry. By default, it is assumed that these geometries use the spatial reference system with the ID EPSG:4326 (see https://epsg.io/4326). However, if your geometry records have coordinates in a different spatial reference system, you run into issues when performing spatial queries and displaying your metadata on a map.

In such cases, you need to tell the DocumentStore component the correct spatial reference by specifying the spatial reference's EPSG code in the spatialReferenceWkidOfGeometriesInIndex property. For example, if your geometry data is stored in the index in the coordinate system DHDN / 3-degree Gauss-Kruger zone 2, specify 31466 ( see https://epsg.io/31466).

Property Name Type Default value Description
spatialReferenceWkidOfGeometriesInIndex Number 4326 The EPSG code of the spatial reference system of the geometries in the index.

The DocumentStore and FeatureDocumentStore components allow you to define filter queries using the solr fq -Parameter (Filter Query) that are applied to each search request (select request).
This parameter can be used to further restrict the search without taking the score into account.

The fq-Parameter is not supported by SuggestStore components.

By default, the fq-Parameter is not set.

Example configuration:

"sf_store": {
"FeatureDocumentStore": [
{
"id": "feature-store",
"target": "https://example.com/smartfinder-search/featuresearch",
"additionalParams": {
"fq": "layer:A"
}
}
]
}

Example for FeatureDocumentStore that retrieves ArcGIS FeatureServer data

Layers A, B and C are present in the index. A, B and C correspond to the value descriptiveName, which is specified in the spring-feature-layer-config.xml file for the respective layer. The view of an app should now be restricted to layer A. The corresponding filter query for this is: layer:A If, on the other hand, the view is to be restricted to layers A and C, the filter is: layer:(A OR C)

Restricting the search to a specific layer (only FeatureDocumentStore)

Property Type Default Description
type Object - Object consisting of id and title. id restricts the query to a layer, and title is appended to the result title (shown in search-ui).
appendTypeToResult Boolean false If set, the title is appended to the result item's title.

Example configuration:

"sf_store": {
"FeatureDocumentStore": [
{
"id": "feature-store",
"target": "https://example.com/smartfinder-search/featuresearch",
"type": {
"title": "title",
"id": "LayerId"
},
"appendTypeToResult": true
}
]
}

Server Sorting (solr)

The FeatureDocumentStore and DocumentStore component allow to configure the sort solr parameter for the select request.

Property Type Mandatory Default Description
useCustomSorting Boolean no false Determines whether custom sorting should be used instead of boosting parameters.
sortField String no title_string Specifies the field for sorting when useCustomSorting is enabled.
sortOrder String no asc Specifies the sort order when useCustomSorting is enabled. Allowed values: asc, desc.

The following is an example of a customized configuration for using alphabetical sorting according to the title_token field:

"sf_store": {
"FeatureDocumentStore": [
{
"id": "feature-store",
"target": "https://example.com/smartfinder-search/featuresearch",
"useCustomSorting": true,
"sortField": "title_token",
"sortOrder": "asc"
}
]
}

Configuring popups for FeatureDocumentStores

To enable and configure popups for FeatureDocumentStore, you can use the following properties:

Property Type Default Description
popupEnabled Boolean false If set to true, popups are enabled for the store.
popupTemplate Object - Defines the template for the popup content.
"sf_store": {
"FeatureDocumentStore": [
{
"id": "feature-store",
"target": "https://example.com/smartfinder-search/featuresearch",
"popupEnabled": true,
"popupTemplate": {
"title": "{title}",
"content": [
{
"type": "fields",
"fieldInfos": [
{
"fieldName": "id",
"label": "ID"
},
{
"fieldName": "layer",
"label": "Layer"
},
{
"fieldName": "title",
"label": "Titel"
}
]
}
]
}
}
}