Bug 698605

Summary: Boolean Query in disjunctive normal form not supported
Product: [Community] Bugzilla Reporter: Chris Ward <cward>
Component: Query/Bug ListAssignee: PnT DevOps Devs <hss-ied-bugs>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: medium    
Version: 3.6CC: pbonzini
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-29 12:22:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Chris Ward 2011-04-21 11:33:01 UTC
Description of problem:
I suspect this might not be 'bug' but rather an RFE... Or possibly there's a different order i can use to format the boolean queries to get the results i'm looking for?


The following boolean query fails to return the expects results.

	[Status] [EQUALS] [VERIFIED]
	OR
	[Status] [CONTAINS ANY STRING] [ON_QA, RELEASE_PENDING]
	AND
	[Verified] [CONTAINS ANY STRING] [SanityOnly, Customer, Adaptec, AMD, Areca, BEA, BMC, Broadcom, Brocade, Bull, Chelsio, Cisco, Dell, Egenera, EMC, Emulex, Exar, Fujitsu, Hitachi, HP, IBM, Intel, Lenovo, LSI, NEC, NetApp, Exar, Neterion, Nokia, Nvidia, PMC-Sierra, Promise, Qlogic, SAP, SGI, Stratus, Sun, Sybase, Symantec, Unisys]


https://bugzilla.redhat.com/buglist.cgi?type0-1-0=anywordssubstr&field0-1-0=cf_verified&field0-0-0=bug_status&type0-0-1=anywordssubstr&field0-0-1=bug_status&query_format=advanced&value0-1-0=Customer%2C%20Adaptec%2C%20AMD%2C%20Areca%2C%20BEA%2C%20BMC%2C%20Broadcom%2C%20Brocade%2C%20Bull%2C%20Chelsio%2C%20Cisco%2C%20Dell%2C%20Egenera%2C%20EMC%2C%20Emulex%2C%20Exar%2C%20Fujitsu%2C%20Hitachi%2C%20HP%2C%20IBM%2C%20Intel%2C%20Lenovo%2C%20LSI%2C%20NEC%2C%20NetApp%2C%20Exar%2C%20Neterion%2C%20Nokia%2C%20Nvidia%2C%20PMC-Sierra%2C%20Promise%2C%20Qlogic%2C%20SAP%2C%20SGI%2C%20Stratus%2C%20Sun%2C%20Sybase%2C%20Symantec%2C%20Unisys&value0-0-1=ON_QA%2C%20RELEASE_PENDING&type0-0-0=equals&value0-0-0=VERIFIED


 
Actual results:
This query returns only bugs matching

	[Status] [CONTAINS ANY STRING] [ON_QA, RELEASE_PENDING]
	AND
	[Verified] [CONTAINS ANY STRING] [Customer, Adaptec, AMD, Areca, BEA, BMC, Broadcom, Brocade, Bull, Chelsio, Cisco, Dell, Egenera, EMC, Emulex, Exar, Fujitsu, Hitachi, HP, IBM, Intel, Lenovo, LSI, NEC, NetApp, Exar, Neterion, Nokia, Nvidia, PMC-Sierra, Promise, Qlogic, SAP, SGI, Stratus, Sun, Sybase, Symantec, Unisys]
 

Expected results:

The query would return bugs match the first and second part.


Additional info:

Perhaps the RFE here is to enable AND | OR operations between groups of booleans... eg


BOOL GROUP 1
	[Status] [EQUALS] [VERIFIED]

	OR

BOOL GROUP 2
	[Status] [CONTAINS ANY STRING] [ON_QA, RELEASE_PENDING]
	AND
	[Verified] [CONTAINS ANY STRING] [...]

p.s. sorry for the terrible summary 'boolean query is failing'; i couldn't think of anything more specific... :)

Comment 1 Paolo Bonzini 2011-05-02 14:46:58 UTC
There is a way to make your query work, by using de Morgan's laws: you want

    a or (b and c)

That can be rewritten as

    not (not a and not (b and c)) 

and then

    not (not a and (not b or not c))

This becomes:

[X] Not (negate this whole chart) 
[Status] [IS NOT EQUAL TO] [VERIFIED]

AND

[Status] [CONTAINS NONE OF STRINGS] [ON_QA, RELEASE_PENDING] OR
[Verified] [CONTAINS NONE OF STRINGS] [...]

Example query:

https://bugzilla.redhat.com/buglist.cgi?negate0=1&type0-1-0=nowordssubstr&field0-1-0=cf_verified&field0-0-0=bug_status&type0-1-1=nowordssubstr&classification=Red%20Hat&query_format=advanced&value0-1-0=Customer%2C%20Adaptec%2C%20AMD%2C%20Areca%2C%20BEA%2C%20BMC%2C%20Broadcom%2C%20Brocade%2C%20Bull%2C%20Chelsio%2C%20Cisco%2C%20Dell%2C%20Egenera%2C%20EMC%2C%20Emulex%2C%20Exar%2C%20Fujitsu%2C%20Hitachi%2C%20HP%2C%20IBM%2C%20Intel%2C%20Lenovo%2C%20LSI%2C%20NEC%2C%20NetApp%2C%20Exar%2C%20Neterion%2C%20Nokia%2C%20Nvidia%2C%20PMC-Sierra%2C%20Promise%2C%20Qlogic%2C%20SAP%2C%20SGI%2C%20Stratus%2C%20Sun%2C%20Sybase%2C%20Symantec%2C%20Unisys&value0-1-1=ON_QA%2C%20RELEASE_PENDING&field0-1-1=bug_status&type0-0-0=notequals&value0-0-0=VERIFIED&component=kernel-xen&product=Red%20Hat%20Enterprise%20Linux%205

-------------------------

You may think that use "Add another boolean chart" would work too:

 [Status] [EQUALS] [VERIFIED]

 ADD ANOTHER BOOLEAN CHART

 [Status] [CONTAINS ANY STRING] [ON_QA, RELEASE_PENDING]
 AND
 [Verified] [CONTAINS ANY STRING] [...]

Unfortunately, https://wiki.mozilla.org/Bugzilla:Search.pm documents that "ADD ANOTHER BOOLEAN CHART" simply ANDs the resulting charts together, rather than OR them.  So this option fails to provide additional expressiveness.

I'm not a bugzilla maintainer, so I won't close this, but I guess that can be done after you played a bit with the above sample query?

Comment 2 Chris Ward 2011-05-02 15:39:19 UTC
Sweet. Thanks for the work around! Makes me go cross-eyed... not exactly intuitive. But Laws are Laws. I'm glad they work!

Closing

Comment 3 Chris Ward 2011-05-10 08:20:01 UTC
I think this bug is still valid, even though my first case had a work around... Investigating...


([Flags] [CONTAINS THE STRING] [rhel-6.1.0-]
AND 
[Status] [CONTAINS ANY STRING] [NEW, ASSIGNED, MODIFIED, POST])
   OR
   ([Flags] [CONTAINS THE STRING] [rhel-6.1.0+]
   AND
   [Resolution] [CONTAINS NONE OF THE STRINGS] [ERRATA, CURRENT_RELEASE])

Comment 4 Chris Ward 2011-05-10 08:23:29 UTC
([Flags] [CONTAINS THE STRING] [rhel-6.1.0-]
AND 
[Status] [CONTAINS ANY STRING] [NEW, ASSIGNED, MODIFIED, POST])
   OR
   ([Flags] [CONTAINS THE STRING] [rhel-6.1.0+]
   AND
   [Status] [IS EQUAL TO] [CLOSED]
   AND 
   [Resolution] [CONTAINS NONE OF THE STRINGS] [ERRATA, CURRENT_RELEASE])

Comment 5 Chris Ward 2012-02-29 12:22:55 UTC
This should be doable in 4.2 since nested queries are supported (ie, parenthesis)