-
Notifications
You must be signed in to change notification settings - Fork 5
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
Instrument search is case-sensitive #731
Comments
As an update to this issue, the filters which are used on table/card views are all case-sensitive. A query for the instrument "SANS2D" using the instrument filter on the ISIS views using lowercase ("sans2d") would not work, neither would "Sans2D". For instruments specifically, as @louise-davies mentioned, we could just make the filter text uppercase since instruments are all uppercase in ISIS. It would be better to have a way to have a case-insensitive search with the API query since the other fields are also case-sensitive. @MRichards99 is there a way to have case insensitivity? |
I believe these filters use the |
Just as a follow-up to this @MRichards99 the issue seems to be with the card view components for ISIS/DLS and not with the query itself. Every other table/card view does it correctly. It was a case of the I'll provide a fix for this which requires a minor change to the |
@GoelBiju thanks for the update! |
I need to do a check on the ISIS/DLS views to see if there are any issues with filtering anywhere else i.e. test out if the other filters on the views work as well. |
@MRichards99 so what @louise-davies had mentioned a couple of days before was that instrument search is not working for ISIS on the deployed data. So this query for "SANS2D" works whereas this one for "sans2d" does not. This is not an issue with development data or when running locally, however. |
@GoelBiju I've just noticed this in blocked on the sprint board - do you need anything additional from the API? |
Yeah seems like the search on instrument name search on the ISIS instrument table view is an issue with the way we are doing the search query. I'll remove it from blocked since from @louise-davies mentioned in a meeting it could be fixed by altering the query. Need to confirm if this is the issue or not still. |
Ah ok, I just wanted to make sure I wasn't holding you up if you needed a feature implementing on the API! :) |
No problem, thanks for it @MRichards99! 😃 |
|
@GoelBiju this is marked as ready for review but by the sounds of it it's still being worked on. Shall I wait on your go before having a look at it? |
@sam-glendenning I had updated since it does fix the instrument filter which was not working correctly before but there are additional issues. I have put a "WIP" on the pull request now since it is still in progress. Thanks for notifying me 😃 |
Looking further into this issue, the difference between the query that we make and what TopCAT presently does is the @MRichards99 like we mentioned before it seems this might be something has to be done on the API? |
I think the other important thing to note that we need to do this due to different databases working differently. Preprod doesn't have this issue since it's using a MariaDB database, but the proper ICATs run on Oracle databases and so this is why it's being seen on those servers. |
@GoelBiju so does I was thinking I'd just be able to add another branch to this conditional that just passes My next thought was to try and replicate the TopCAT query into the API to create our own case insensitive operator: elif self.operation == "ilike1":
self.field = f"UPPER({self.field})"
where_filter = self.create_condition(self.field, "like", f"%{self.value}%") This code results in this: {'UPPER(title)': "like '%police%'"} A working example using a regular {'title': "like '%police%'"} Python ICAT gets confused with the Unless there's an Oracle DB specific solution we could implement (providing there's some way to check what kind of database is running within the API)? |
I think you are right @MRichards99, I am thinking it would only convert the value already stored in that field in the database to uppercase and then perform the A small detail I noticed in the TopCAT query was the query string e.g. "isis" was also in uppercase ("ISIS") and this must have been checked against the field which was also converted to uppercase. So maybe that was the solution in place, it relied on converting both to uppercase to check? So looking online we would need to do upper/lower on both sides of the query in order to replicate this. Would we need to do the upper/lower on the actual query itself and not the condition that is returned? |
That's great @MRichards99, I was initially thinking that having upper on one side means the opposite would not work. Since it is working with |
@GoelBiju I've just tested on ISIS dev and SELECT o FROM Investigation o WHERE UPPER(o.title) like UPPER('%toMAto%') The |
That's great @MRichards99, hopefully, we can figure out how to apply the |
I think I've found a solution for this, with some small changes on Python ICAT and perhaps an additional operator for DataGateway API's where filter (we can have the changes into |
I've opened an issue for this (icatproject/python-icat#86) and waiting on permissions so I can commit my changes and create a PR for them. |
…rch-#731 Fix instruments filter on ISIS/DLS card views (#731)
Status update: I've created a PR for my suggested Python ICAT changes (icatproject/python-icat#87). For DataGateway API, there are two options - I can make the existing elif self.operation == "ilike":
self.field = f"UPPER({self.field})"
where_filter = self.create_condition(
self.field, "like", f"UPPER('%{self.value}%')",
) I'm happy to do this, but I'm also conscious doing this would mean all |
Are there many instances in the frontend which would require case sensitivity in the query? I can't think of any. Unless anyone comes up with something that'll break everything, I'd support changing the |
That's great @MRichards99 that there is a solution now. I think it would be nice to have it configurable by having a separate operator but like @sam-glendenning if we do not have a case where we need case sensitivity then it might be better to support case-insensitivity by default. |
I can't think of anything, one for @louise-davies perhaps |
I think for now we just change the default - we can always add back in a "case sensitive" oeprator later if needed as I can';t imagine a use for one right now |
Once the changes on Python ICAT have been finalised, I'll edit the existing |
Description:
Will commented that the instrument search was case-sensitive. If that’s the case could it all be made case-insensitive, especially as some of the instruments have unusual ‘default’ cases.
I'm not sure if this is referring to lucene search or for instrument filters but we should investigate and resolve this.
Acceptance criteria:
The text was updated successfully, but these errors were encountered: