Bug 1511254 - Host search using OR on facts finds duplicate records and takes a long time
Summary: Host search using OR on facts finds duplicate records and takes a long time
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Search
Version: 6.2.12
Hardware: x86_64
OS: Linux
high vote
Target Milestone: 6.7.0
Assignee: Partha Aji
QA Contact: Omkar Khatavkar
: 1560180 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2017-11-09 00:33 UTC by Manikandan Somasundaram
Modified: 2020-04-14 13:22 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2020-04-14 13:22:23 UTC
Target Upstream Version:

Attachments (Terms of Use)
BZ1511254.patch (1.66 KB, patch)
2019-11-12 17:29 UTC, Mike McCune
no flags Details | Diff
Both 'OR' and 'AND' operators are working (94.52 KB, image/png)
2019-11-29 10:20 UTC, Omkar Khatavkar
no flags Details

System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 25897 0 Normal Closed Using search query for listing content hosts produces unexpected output 2021-01-25 11:31:12 UTC
Red Hat Knowledge Base (Solution) 3429661 0 None None None 2018-05-01 16:26:43 UTC
Red Hat Product Errata RHSA-2020:1454 0 None None None 2020-04-14 13:22:43 UTC

Description Manikandan Somasundaram 2017-11-09 00:33:21 UTC
Description of problem:
 AND and OR operation is not working on satellite as expected, when trying to filtering host with single filter like “facts.bios_vendor = SeaBIOS” it works fine, but when your try to filter using AND and OR operator its not working as expected, when filtering using AND it gives zero result “facts.bios_vendor = SeaBIOS and facts.architecture = x86_64”, when trying to filter using OR result is unstable as it gives around 1700 number of results even through there is only 10 machines registered with satellite.

How reproducible:
- Under Satellite UI - > Hosts → All Hosts → in search tab
- Try to filter host using any fact ex. “facts.bios_vendor = SeaBIOS”
- Also try to filter using any other fact ex. “facts.architecture = x86_64”
- Now combine search filter using AND and OR operator like below and check the result.
   Ex. “facts.bios_vendor = SeaBIOS and facts.architecture = x86_64”
   Ex. “facts.bios_vendor = SeaBIOS or facts.architecture = x86_64”

Actual results:
 - Observe there is no result when using AND operator
 - Observe there is N number of results when using OR operator which is regardless of number of registered clients.

Expected results:
- Should be able to search hosts using AND and OR

Additional info:
 Also tried to search using the query structure given on the link “https://github.com/wvanbergen/scoped_search/wiki/Query-language” but still result is not as expected.

Comment 1 Marek Hulan 2017-11-09 07:36:37 UTC
This works fine with 6.3, moving to ON_QA. Note that the variant with or does not make sense. That would find also hosts that have only bios vendor SeaBIOS and also different hosts which has architecture x86_64. So you could end up with SeaBIOS hosts with i386 arch.

The correct syntax is

> “facts.bios_vendor = SeaBIOS and facts.architecture = x86_64”

I could not find exact upstream fix but it might have changed by the scoped_search update.

Comment 6 Marek Hulan 2017-11-10 07:58:04 UTC
Created redmine issue http://projects.theforeman.org/issues/21625 from this bug

Comment 7 Satellite Program 2017-12-15 09:03:44 UTC
Upstream bug assigned to akarsale@redhat.com

Comment 8 Marek Hulan 2018-03-27 09:49:08 UTC
*** Bug 1560180 has been marked as a duplicate of this bug. ***

Comment 10 Bryan Kearney 2019-07-02 17:53:31 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this, please do not reopen. Instead, feel free to contact Red Hat Technical Support. Thank you.

Comment 12 Bryan Kearney 2019-09-03 19:06:57 UTC
The Satellite Team is attempting to provide an accurate backlog of bugzilla requests which we feel will be resolved in the next few releases. We do not believe this bugzilla will meet that criteria, and have plans to close it out in 1 month. This is not a reflection on the validity of the request, but a reflection of the many priorities for the product. If you have any concerns about this, feel free to contact Red Hat Technical Support or your account team. If we do not hear from you, we will close this bug out. Thank you.

Comment 13 Bryan Kearney 2019-09-05 12:55:08 UTC
Connecting redmine issue https://projects.theforeman.org/issues/25897 from this bug

Comment 14 Bryan Kearney 2019-09-05 14:04:18 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25897 has been resolved.

Comment 15 Bryan Kearney 2019-09-05 14:35:28 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/25897 has been resolved.

Comment 17 Mike McCune 2019-11-12 17:29:26 UTC
Created attachment 1635451 [details]

Comment 18 Mike McCune 2019-11-12 17:31:43 UTC
*** Satellite 6.5.3 Patch ***

This bug will be resolved in 6.6 but if users wish to patch their 6.5 Satellite feel free to apply the attached patch.

1) Download BZ1511254.patch to your Satellite 6.5 Satellite

2) Copy to /usr/share/foreman/BZ1511254.patch

3) cd /usr/share/foreman

4) Patch: 

# patch -p1 < BZ1511254.patch 
patching file app/models/concerns/hostext/search.rb

5) restart

satellite-maintain service restart

Comment 19 Omkar Khatavkar 2019-11-29 10:20:52 UTC
Created attachment 1640632 [details]
Both 'OR' and 'AND' operators are working

Verified this on Satellite 6.7 with Snap 3. Both logical operators are working as expected

Comment 22 errata-xmlrpc 2020-04-14 13:22:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


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