Bug #19137
opennotExists, notEquals, notRegex does not work on subelements like software, disks, etc
Description
If a notXXX
query apply on a sub element (ie a composed query with subquery), then it does not work as expected. It works for element of node summary
.
Say we wan't node without sotware "soft1" installed. If we you use "software" "not regex" "soft1"
, we get all nodes as long as they have at least one other software than soft1
.
The reason is that what we actually do is look for all software not matching soft1
, then get nodes with at least one of the resulting software in their software list.
It should take node with only software in that list.
The same logic works for notEqual
, but not for notExists
, since we can't get the list of software that don't exists.
So we could inverse the composition, which would be more efficient too in most cases (the example on software is very telling: you likely look for nodes with one, or a couple of missing software, and so all non-matching software is likely a ten of thousand long list of elements): we could look for software mathching the regex, and only take nodes with NO software in the resulting list (that works also with notequals and notexists, if for the latter we directly translate it to "take node with no software").
This change does not seem easy at all, since we need to add logic to inverse composition of subquery (making it work correctly with and/or case).
A workaround could be to add a query field "inverse result", default to false, which would returns "all node minus the one matching the query" (and would be ok for most simple case, especially combined with the possibility to compose groupes).