Project

General

Profile

Actions

Bug #12194

closed

Can't search for multiple facts in foreman 1.10.0-RC1

Added by Timo Goebel over 8 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Search
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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.


Related issues 1 (0 open1 closed)

Related to Foreman - Feature #11150: Allow searching of facts as types other than stringClosedImri Zvik07/19/2015Actions
Actions #2

Updated by Marek Hulán over 8 years ago

Despite the fact that it changed previous behaviour, isn't this actually expected?

Actions #3

Updated by Timo Goebel over 8 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.

Actions #4

Updated by Marek Hulán over 8 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.

Actions #5

Updated by Dominic Cleal over 8 years ago

  • Related to Feature #11150: Allow searching of facts as types other than string added
Actions #6

Updated by Dominic Cleal over 8 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.

Actions #7

Updated by Ohad Levy over 8 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.

Actions #8

Updated by Ohad Levy over 8 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.

Actions #9

Updated by Dominic Cleal over 8 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

Actions #10

Updated by The Foreman Bot over 8 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2906 added
Actions #11

Updated by Dominic Cleal over 8 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF