ral-facilities / datagateway-api

ICAT API to interface with the DataGateway
Apache License 2.0
5 stars 4 forks source link

Implement Search API WHERE Filter #260

Closed MRichards99 closed 2 years ago

MRichards99 commented 3 years ago

Description: Similar to DataGateway API, the search API supports a where filter. This uses a different syntax to the WHERE filters in DataGateway API which has additional functionality. Basic syntax: {"where": {"property": "value"}}

The Search API requires all of the LoopBack operators to be supported. The following operators are not implemented in DataGateway API and need to be checked that they can be supported and then implemented into the Search API:

The text operator is something new for the Search API. It's used to query data matching a string and can be applied to the following fields:

We should check what should happen if the text operator is applied to a field not listed above (via the example implementation). I'm guessing a 400 would be appropriate.

AND/OR functionality is required in the Search API as well. DataGateway API uses AND implicitly via Python ICAT, so OR is the new feature required. Python ICAT does not currently support the OR functionality (evidence) so support needs to be added on Python ICAT's side before this can be implemented on the Search API.

Acceptance criteria:

VKTB commented 2 years ago

I investigated the following 3 operators which are currently not implemented in DataGateway API:

between:

nin:

regexp:

MRichards99 commented 2 years ago

Brilliant, thanks for investigating that! It's great they are all supported in Python ICAT.

For the between operator, I think we can assume there will only ever be two values (I don't think you can search between 3 values in query languages?). The search API expects the two values in a list (see example) so if we decide to implement it into DataGateway API, then we should follow the same way of getting the user's input in.

VKTB commented 2 years ago

I agree - we can assume there will only ever be two values. Loop Back's operator documentation seems to indicate that you can only have two values. Happy to implement any of these 3 operators in DataGateway API.