Bug 610155

Summary: Search: relaxed suggestion matching, do not show "empty" suggestions
Product: [Other] RHQ Project Reporter: Joseph Marques <jmarques>
Component: SearchBarAssignee: Joseph Marques <jmarques>
Status: CLOSED CURRENTRELEASE QA Contact: John Sanda <jsanda>
Severity: medium Docs Contact:
Priority: low    
Version: 3.0.0CC: cwelton, jsanda
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-08-12 16:45:33 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joseph Marques 2010-07-01 16:22:05 UTC
Type: trait[alias

Suggest: trait[aliases]
Suggest: trait[jboss.web:type=Host,host=%name%:aliases]

Type: trait[aliases]=

Suggest: "[]"

Type Type: trait[aliases]="[]"

Results: <empty>

-----

So the "[]" value was suggested even though there are no results with "[]" as the value for the "aliases" trait.  In this case, the "[]" is only a valid suggestion for the <jboss.web:type=Host,host=%name%:aliases> trait.

Suggested enhancement is two-fold:

1) By default, provide substring matching for the bracketed parameter:

So "trait[aliases]"
Translates to "LOWER(schedule.definition.name) LIKE '%aliases%'"
Instead of "schedule.definition.name = 'aliases'"

But then we should also support the boundary matching (startsWith, endsWith, and exact) the same as we do for values on the right-hand side of the comparison operator.  So if the user wants to perform more precise matches, they could add additional boundary qualifiers:

trait[^aliases] --> "LOWER(schedule.definition.name) LIKE 'aliases%'"
trait[aliases$] --> "LOWER(schedule.definition.name) LIKE '%aliases'"
trait[^aliases$] --> "LOWER(schedule.definition.name) LIKE 'aliases'"

2) Do not provide suggestions which have no results.  In this case, if the user types "trait[^aliases$]", and if we know that there aren't any resources in the system with a value for that exact trait name, then it shouldn't be suggested in the first place.  However, this case will be MUCH more uncommon once #1 is implemented above, and all bracketed-parameter searches become relaxed.  Thus, I suggest we first tackle #1, and then revisit #2 only if the user interaction still feels awkward.

Comment 1 Joseph Marques 2010-07-09 12:08:07 UTC
commit 86e7669b628a750989a344e05dfe3e37b884f254
Author: Joseph Marques <joseph>
Date:   Thu Jul 8 18:45:57 2010 -0400

BZ-610155: relax suggestion matching, suppress "empty" results
    
* only suggest plugin configuration param names for inventoried resources
* only suggest resource configuration param names for inventoried resources
* only suggest trait names for inventoried resources

* only suggest type values for inventoried resources
* only suggest plugin values for inventoried resources
* only suggest plugin configuration values for inventoried resources with the specific plugin configuration param name, case-insensitively (relaxed)
* only suggest resourceplugin configuration values for inventoried resources with the specific resourceplugin configuration param name, case-insensitively (relaxed)
* only suggest trait values for inventoried resources with the specific trait param name, case-insensitively (relaxed)

* only suggest type values for visible groups in inventory
* only suggest plugin values for visible groups in inventory

Comment 2 Corey Welton 2010-07-26 18:41:58 UTC
QA Verified.  Only appropriate values are offered for appropriate, corresponding resources;  if there are no valid suggestions, given a specified string, no "bad" suggestions are offered on said bad string.

Comment 3 Corey Welton 2010-08-12 16:45:33 UTC
Mass-closure of verified bugs against JON.