ministryofjustice / data-catalogue

Data catalogue • This repository is defined and managed in Terraform
MIT License
2 stars 0 forks source link

Highlight Matched Field Behaviour #37

Closed mitchdawson1982 closed 1 month ago

mitchdawson1982 commented 6 months ago

Background

There are inconsistencies with the behaviour of matched fields within datahub for custom properties and how these are presented in the front end, this ticket serves to outline these behaviours with a view to fixing them at some point in the future. Datahub returns matched fields for each result. Matched fields is a list of dictionaries for each field.

Consensus is sought on whether we should display matched fields for applied filters or only fields matched through a query term and hide matched fields from search results if this is the case.

Inconsistencies

  1. Datahub returns applied filter fields and populated values as matched fields when a search term is present.

Image

This example indicates that the search term "analytical" was found within "Description, Domain, Sensitivity level" Fields. Sensitivity level was returned as a custom property matched field with a populated value of 'value': 'sensitivityLevel=OFFICIAL'.

Domain = HMCTS & Classification = Official applied and analytical query term present.
Matched fields returned: [{'name': 'customProperties', 'value': 'sensitivityLevel=OFFICIAL'}, {'name': 'fieldDescriptions', 'value': 'convicted_rank and convicted_rank_desc are created at the level of the offence (see [here](https://github.com/moj-analytical-services'}, {'name': 'domains', 'value': 'urn:li:domain:31754f66-33df-4a73-b039-532518bc765e'}]

Note: Value field is populated.

  1. Datahub doesn't return populated filter fields values when no search term has been applied.

Image

In this scenario where a domain and custom property filter has been applied and no search term is included (NOTE: absence of "analytical"), datahub returns only the matched field names. This is insufficient to obtain the actual property that was applied for a custom property field. We are able to populate Domain as we only need the name, however this is not possible for customer properties where the actual applied property is missing.

Domain = HMCTS & Classification = Official applied and no query term present. Matched fields returned from datahub: [{'name': 'customProperties', 'value': ''}, {'name': 'domains', 'value': ''}]

Note: Value field is empty.

Potential Solutions

  1. Only display matched fields on search results when a query is present, effectively hiding it when no query has been applied.
  2. Remove filter matched fields so that only fields matched by a query are displayed