origo icon indicating copy to clipboard operation
origo copied to clipboard

Search configuration revamp

Open MattiasSp opened this issue 3 years ago • 4 comments

Description When configuring the Search control, the five current options are an emergent behaviour rather than explicitly configured. Choosing a search mode is done by selecting the correct combination of config parameters, some of which have sort of the same meaning but different names - in order to differentiate which search mode is to be used.

This is, in my opinion, a rather indirect and less than user (admin) friendly way of controlling the Search control's behaviour.

Proposed solution

In essence, I see the Search control config as having two different parts;

  1. A search endpoint that is queried and returns a JSON array
    • url
    • searchAttribute specifies which attribute in the JSON results that should be displayed in the search result list
    • title, titleAttribute or the title of the map layer referenced by the attribute named with layerNameAttribute or layerName used to group results under different headings when groupSuggestions is true
  2. Feature info configuration config parameters that define where to get the geometry and attributes to be able to show or pan to a search result in the map
    • geometryAttribute (or northing plus easting)
    • title, titleAttribute or the title of the map layer referenced by the attribute named with layerNameAttribute or layerName the title is used again as a heading for the feature info popup when a result is clicked
    • idAttribute only used for option 1, to get the id of the feature for which to fetch feature info from the layer
    • contentAttribute only used for option 3, to use another attribute for the feature info popup text, separate from searchAttribute

The current complexity is due to the feature info configuration and stems from the need to fetch information from different sets of sources;

  • From the search result itself,
  • from named map layers,
  • or from text value in the Search config.

So why not go all in and make the configuration both fully flexible (allowing any combination of sources instead of just the current five) and more explicit at the same time?

Based on the above analysis I suggest a revamp of the configuration where we explicitly state both the source reference and its source type for each required information. Also, the searchAttribute should be renamed to something like displayAttribute since it doesn't actually control which attribute is searched - only which attribute in the results that should be displayed.

I'll try to add suggestions for what the configs would look like for the five different options soon.

MattiasSp avatar Jan 14 '22 14:01 MattiasSp