providing combination of "and" / "or" search criteria option in glare

Registered by Kushal Agrawal

providing the combination of "and" / "or" search criteria option in glare for search query options in list-artifact API.

- Why do we want to add this feature? The drive to make the change:

Right now during API call of artifacts/{artifact_type} or artifacts/all search criteria is provided as the Query parameter in URL. for each parameter it is like :
field_name=search_criteria:values_to_match_comma_separated

during this approach, all the fields which are sent in the query are joined in database layer with the _and operator. Right now it is restricting a user to search based on _or operator.

- Solution: Providing an additional field in query parameter which will define operator.

With a new approach, we will be adding a third portion of the query parameter value to define the operation combiner. which will give the user an option to choose between _and / _or.

now the query parameter will look like this:

field_name=search_criteria:values_to_match_comma_separated:(and/or)

To maintain backward compatibility in case of absence of last parameter (and/or) it will be considered as "and" by default.

- Impacts :

There will be changes required in glare-client to accommodate this feature.

Example:
So for an example sample_artifact available in the glare. which contains multiple fields such as "int1" , "link1" , "bool1", "str1". So if anybody wants to filter the data based on the below where clause: |

> where int1=5 and link1="http://example.com" and (bool1=False or str1="someText")

So for corresponding where clause corresponding queryParams in glare will be:
int1=eq:5:and&link1=eq:http://example.com&bool1=or:eq:False&str1=or:eq:"someText"

Validation for values :
In case Filter values for any field has colon(":") as part of values it is mandatory to include operator, else it will be considered as invalid filter value and 400 Bad request will be thrown.

- Limitation :

Currently, this feature supports only one set of "OR" condition group. All the filter variables which are separated by or will be taken as a whole and validated.

Blueprint information

Status:
Complete
Approver:
Mike Fedosin
Priority:
Undefined
Drafter:
Kushal Agrawal
Direction:
Needs approval
Assignee:
Kushal Agrawal
Definition:
Review
Series goal:
Proposed for trunk
Implementation:
Implemented
Milestone target:
None
Started by
Kushal Agrawal
Completed by
Kushal Agrawal

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/glare-search-artifact-query-update,n,z

Addressed by: https://review.openstack.org/541569
    and/or query combiner for filter options

Addressed by: https://review.openstack.org/558177
    and/or query combiner for filter options

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.