Skip to content

Advanced search using collections

This section is under development

Collections are used to make the search blocks work, this includes facets, simpleSearch, multiSearch, searchList, searchFilter, clear, results, filterResults, and collectionText blocks.

  1. inline - an array of objects with label and value in the list attribute.
  2. rdforms - reuse "choices" from RDForms template choice items as they already provide labels and values. Reuse by providing item id in the templatesource attribute.
  3. preload - preload collection from entrystore, this is done by providing the constraining attributes rdftype and an optional context.
  4. search - an solr search will be performed to yield a collection of the matching entries, typically by combining a given rdftype attribute with a generic search term, for instance from typeahead input field.
  5. facet - the latest solr search performed by the search block (with the facet flag) will yield a collection from the facets in the results. The property attribute is mandatory to indicate the facet and an nodetype must be specified to be literal if the facet values are not to be treated as URIs which is the default.
  6. range - the collection corresponding to values that can be searched for via range queries like properties with dates or integers.
  7. check - entries with given values for a given property will be included in or excluded from the search result. type, name, property, nodetype and values are mandatory. related: 'true' is optional. Also modifier (values not / and) is optional and will default to modifier: 'and'
  8. radio - a more complex filter where entries matching a selected option query will be included in the search result. type, name and options are mandatory where options is an array of option objects. each option needs a name, a query and a label. The query is written as an object and only supports using rdfType, and and or. e.g. query: { rdfType: ['dcat:Dataset'], and: { not: { 'tag.literal': 'camping' } } }. See documentation https://entrystore.org/js/stable/doc/module-store_SolrQuery.html for correct syntax and expected behaviour.

Parameters in a collection

parameter value explanation
type text must be one of the values, listed above
name text mandatory unique name of collection, used from other blocks to reference it
label text a nice label to show as headings in facet and multiSearch block
property RDF property the property to constrain in the query
nodetype text must be either literal, uri, date or integer.
context text the contextid to restrict a query for values from, use when the type parameter is search
rdftype RDF class a URI corresponding to a RDF class from which values in this collection have to be instances of, use when the type parameter is search
limit number restriction on how many values that will be shown in the facet or multiSearch blocks before there is a showmore button
showmore text text to show on the show more button
showless text text to show on the show less button
labelRegexp RegExp regular expression that will extract parts of the labels via capturing groups
labelTemplate string template expression with variables 1 and 2 inside corresponding to up to two capturing groups or the whole label if there are now labelRegExp, for example ${1} municipality
click url the url the user will go to if clicking on an individual value, the esb: prefix is allowed. See the documentation on the multiSearch block
namedclick text a named click, see documentaiton on the multiSearch block
linkparam text must be used together with the click or namedclick parameters. If the value entry is given the selected entrys entryid and contextid will be inserted via the esb_entry and esb_context parameters in the link. If the value is group the collection name is used as parameter name and the value is the selected value. In all other cases the value of the linkparam will be used as param. In all situaionts, the value is first shortened if possible.
templatesource text the id of an rdforms template from where values for the collection will be retrieved, this only works if the type is rdforms and the identified template corresponds to a choice item with static choices
sort boolian/'desc' if true values will be afabeticaly orderd if set to 'desc' the order is reverced