Bug #12194
closedCan't search for multiple facts in foreman 1.10.0-RC1
Description
Foeman 1.10.0 introduced a bug, that you can't search for multiple facts in the host overview (both via gui and api)
A search query like "facts.app_tier = prod and facts.project = abc" shows no results in 1.10, though there were a lot of results in 1.9.2.
Searching for "facts.app_tier = prod or facts.project = abc" works though.
Updated by Daniel Lobato Garcia about 9 years ago
https://github.com/theforeman/foreman/commit/3f8e6c33624f33acd65b371bf67549606397286e this looks like the culprit - investigating...
Updated by Marek Hulán about 9 years ago
Despite the fact that it changed previous behaviour, isn't this actually expected?
Updated by Timo Goebel about 9 years ago
Marek Hulán wrote:
Despite the fact that it changed previous behaviour, isn't this actually expected?
I can't follow. Why should this be expected behavior? Searching for hosts by two or more facts seems a reasonable requirement for me. For example I might want to search for hosts that have jruby and mysql installed. This is an arbitrary example, but - unfortunately - currently broken.
Updated by Marek Hulán about 9 years ago
Ah sorry, I misunderstood what you try to search for, I thought you were trying to search facts, not hosts. Ok, sounds as a valid bug.
Updated by Dominic Cleal about 9 years ago
- Related to Feature #11150: Allow searching of facts as types other than string added
Updated by Dominic Cleal about 9 years ago
- Translation missing: en.field_release set to 63
Daniel Lobato Garcia wrote:
https://github.com/theforeman/foreman/commit/3f8e6c33624f33acd65b371bf67549606397286e this looks like the culprit - investigating...
Yes, reverting this seems to fix it.
Updated by Ohad Levy about 9 years ago
I believe this is happening when having a two joins on the same table, this was fixed in the past on scoped search at https://github.com/wvanbergen/scoped_search/commit/a7666e4b0a44cf1c066848cc8ab2f57301a7a218.
the solution should be to add aliases to table join, per condition set (name / value), however from a quick glance I'm not sure how to resolve it within the current implementation of external method.
AFAIR forcing a join should trigger the join aliasing code in scoped search.
Updated by Ohad Levy about 9 years ago
I think the right way to solve it is probably via a patch to scoped_search, as there is no way to control the join statement from within the ext_method.
Updated by Dominic Cleal about 9 years ago
- Status changed from New to Assigned
- Assignee set to Dominic Cleal
Ohad Levy wrote:
I think the right way to solve it is probably via a patch to scoped_search, as there is no way to control the join statement from within the ext_method.
I don't think that's correct, it appears that joins can be controlled by adding a joins element to the returned hash: https://github.com/wvanbergen/scoped_search/blob/v3.2.2/lib/scoped_search/query_builder.rb#L388-L394
Updated by The Foreman Bot about 9 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2906 added
Updated by Dominic Cleal about 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 57e9d8a360625afb6dfe292655cc03cd65719073.