fix: error occurs when searching for anything containing a full stop. #1463 - #1196
Conversation
| .orderBy('proposal_pk', 'desc') | ||
| .modify((query) => { | ||
| if (filter?.text) { | ||
| const jsonPath = `$[*].name ? (@.type() == "string" && @ like_regex "${filter.text}" flag "i")`; |
There was a problem hiding this comment.
This is nice. I was thinking of doing a generic fix.
Here we have added special character escaping for non json columns. We can add one for json columns and use it across. What do you think?
This function can be applied to the default ProposalDataSource as well, if you could. Else we from ESS can take it up.
There was a problem hiding this comment.
This is nice. I was thinking of doing a generic fix.
Here we have added special character escaping for non json columns. We can add one for json columns and use it across. What do you think?
This function can be applied to the default ProposalDataSource as well, if you could. Else we from ESS can take it up.
I agree with your generic fix for this bug — it’s better than our one-off solution. Please let us know once your PR is merged.
There was a problem hiding this comment.
This is nice. I was thinking of doing a generic fix.
Here we have added special character escaping for non json columns. We can add one for json columns and use it across. What do you think?
This function can be applied to the default ProposalDataSource as well, if you could. Else we from ESS can take it up.
@yoganandaness A generic special character escaping for json column is added.
simonfernandes
left a comment
There was a problem hiding this comment.
Looks nice! There are a couple of places in PostgresProposalDataSource that could also be updated with the new functions.
Reviewed Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
I completed testing and confirmed the new function operates solely within the current place. |
|
@bashanlam I meant that you can also add these utility functions to two places in the |
…eJsonbPathLike function.
|
@yoganandaness We've updated PostgresProposalDataSource to include the whereJsonbPathLike and orWhereJsonbPathLike functions. Could you please verify and review if this is working correctly for ESS? Thanks. |
Co-authored-by: Simon Fernandes <simon.fernandes@stfc.ac.uk>
yoganandaness
left a comment
There was a problem hiding this comment.
More suggestions to make it more generic
- Currently, when doing json search, we are targetting only the field
name. However, if we want to search other fields, we can pass it as parameter - % is not needed for json search unlike normal search. Hence it can be removed
|
@bashanlam Was also wondering, if we could attach e2e for Instrument name search in Proposals table |
Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
Co-authored-by: Yoganandan Pandiyan <132274772+yoganandaness@users.noreply.github.com>
yoganandaness
left a comment
There was a problem hiding this comment.
Looks good to me. Appreciating an e2e.
Closes UserOfficeProject/issue-tracker#1463
Description
This PR fix the error occurs when searching for anything containing a full stop (e.g. bam.de) while using the instrument scientist role.
Motivation and Context
Fix the error occurs when searching for anything containing a full stop (e.g. bam.de) while using the instrument scientist role.
Changes
Update the data source to fix the error occurs when searching for anything containing a full stop (e.g. bam.de) while using the instrument scientist role.
How Has This Been Tested?
Manually
Tests included/Docs Updated?