Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quoted search fix #839

Merged
merged 4 commits into from
Sep 17, 2024
Merged

Quoted search fix #839

merged 4 commits into from
Sep 17, 2024

Conversation

mitchdawson1982
Copy link
Collaborator

@mitchdawson1982 mitchdawson1982 commented Sep 16, 2024

Adds a method to the search service to handle updated search behaviour in datahub. The recent datahub changes now mean that query strings containing either quotes, underscores or full stops are treated as exact matches.

This PR ensures that quoted queries are passed through to search unchanged whereas unquoted queries containing underscores are altered to remove them and replace them with spaces, to ensure a non-exact match search is performed.

@mitchdawson1982 mitchdawson1982 requested a review from a team as a code owner September 16, 2024 16:07
MatMoore
MatMoore previously approved these changes Sep 17, 2024
Copy link
Contributor

@MatMoore MatMoore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but does it solve the bug on the ticket where "Common Platform" doesn't match anything?

https://find-moj-data.service.justice.gov.uk/search?query=%22Common+Platform%22&domain=

Even with exact matching I would expect this to return results, since the whole phrase is in the description of https://find-moj-data.service.justice.gov.uk/details/table/urn:li:dataset:(urn:li:dataPlatform:dbt,cadet.awsdatacatalog.common_platform_derived.cases_fct,PROD)

Regarding the matching behaviour of a quoted query, in this instance "Common Platform". My view is that I wouldn't expect this to match as it is a partial term. Common Platform does of course appear in a number of results, but when we are quoting the term we are saying that we are expecting a field with only this value, which isn't the case hence no results.
"Lookup table for Common Platform hearing result shortcodes." returns results because it is an exact match for an entire field (description), "Common Platform" isn't an exact match for any fields on the current dataset.

home/service/search.py Outdated Show resolved Hide resolved
@mitchdawson1982 mitchdawson1982 merged commit 8d8e633 into main Sep 17, 2024
8 checks passed
@mitchdawson1982 mitchdawson1982 deleted the fmd-783-quoted-search-work-around branch September 17, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants