Revision 57e9d8a3
Added by Dominic Cleal over 8 years ago
app/models/fact_value.rb | ||
---|---|---|
|
||
def self.search_cast_facts(key, operator, value)
|
||
{
|
||
:conditions => "#{sanitize_sql_for_conditions(["fact_names.name = ?", key.split('.')[1]])} AND #{cast_facts(key,operator,value)}",
|
||
:conditions => "#{sanitize_sql_for_conditions(["fact_names.name = ?", key.split('.')[1]])} AND #{cast_facts('fact_values', key, operator, value)}",
|
||
:include => :fact_name,
|
||
}
|
||
end
|
||
|
||
def self.search_value_cast_facts(key, operator, value)
|
||
{
|
||
:conditions => cast_facts(key,operator,value)
|
||
:conditions => cast_facts('fact_values', key, operator, value)
|
||
}
|
||
end
|
||
end
|
Also available in: Unified diff
fixes #12194 - join fact tables multiple times for each search term
scoped_search usually generates a new inner join for each search term
when searching through a key/value table layout to correctly search for
hosts via multiple facts. Since the change to ext_method in 3f8e6c33, a
fixed table name was used. This is changed to multiple joins to match
how scoped_search works with multiple search terms.