Bug 1470251 - Anding of multiple filters does not product the required results
Summary: Anding of multiple filters does not product the required results
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: API
Version: unspecified
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: GA
: cfme-future
Assignee: Tim Wade
QA Contact: Martin Kourim
URL:
Whiteboard: rest:filter
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-07-12 15:25 UTC by Allen W
Modified: 2017-12-05 15:58 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-07-19 17:55:04 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Allen W 2017-07-12 15:25:21 UTC
An example query:

 ```
GET http://localhost:3000/api/services?expand=resources&filter%5B%5D=ancestry%3Dnull&filter%5B%5D=tags.name%3D%2Fmanaged%2Fenvironment%2Fdev&filter%5B%5D=tags.name%3D%2Fmanaged%2Flocation%2Fny
```

Running a query with each individual tag reveals the correct results. And so, one would imagine the above query would return all services with the both tag values, when in fact nothing is returned :(



Here's a pr awaiting a fix: https://github.com/ManageIQ/manageiq-ui-service/pull/840

Comment 2 Dave Johnson 2017-07-14 03:01:00 UTC
Please assess the impact of this issue and update the severity accordingly.  Please refer to https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity for a reminder on each severity's definition.

If it's something like a tracker bug where it doesn't matter, please set it to Low/Low.

Comment 3 Tim Wade 2017-07-19 17:50:42 UTC
This looks to be a problem with the nature of the relationships being queried. I think officially we do not support queries like that based on one-to-many relationships. What it translates to is "find me all rows where the tag name is /managed/environment/dev AND /managed/location/ny", and since there are no rows where the tag name can be two different things it yields 0 results.

I can see that might be two actions to take on this:

1. We should update the documentation to make this limitation more clear
2. An API that wraps "CONTAINS" - type expressions would be a useful enhancement

Comment 4 Allen W 2017-07-19 17:53:28 UTC
DOH 2. would be what we're looking for, so not a bug, looking like something we should shelve for the time being


Note You need to log in before you can comment on or make changes to this bug.