Red Hat Bugzilla – Bug 615017
Support boundary matching for search parameters
Last modified: 2010-08-12 12:44:18 EDT
Description of problem:
Currently, boundary matching tokens (^ $) are only supported for values on the right hand side of the comparison operator allowing for search execution of bounded values. It would nice if we also supported,
* boundary matching for parameter suggestions
* boundary matching for value suggestions
* search execution for bounded parameters
Here are some examples,
connection[^jboss] --> match any connection property that starts with 'jboss'
connection[$Dir] --> match any connection property that ends with 'Dir'
connection[^jboss]=^/opt --> match any connection property whose name starts with jboss and whose value starts with /opt
Version-Release number of selected component (if applicable):
Steps to Reproduce:
Author: Joseph Marques <firstname.lastname@example.org>
Date: Thu Jul 15 15:11:05 2010 -0400
BZ-615017: enhance search suggestion/execution support for boundary matching
this fix supports all three styles for search terms:
this fix enhances boundary matching in the following ways:
1) adds boundary matching for 'parameter' suggestions
2) adds boundary matching for 'values' suggestions
3) supports search execution for bounded 'parameter'
4) supports search execution for bounded 'values'
Joseph, I am not sure I understand the distinctions between 1 and 3 and between 2 and 4. Can you clarify these a bit, maybe with some examples? Thanks.
Sure. Items 3 and 4 are the easiest to understand. Basically, pretend for a moment that search suggestions don't exist, and that you have to type the entire pattern by hand and know the search syntax in your head. If you type something like:
And press enter to initiate the search, you are telling the search execution routines to look for connection properties whose name begins with "jboss" (without quotes) and whose value ends with "abc" (without quotes). In this case, the "^jboss" fragment is referred to as the bounded parameter (item 3), and "abc$" is referred to as the bounded value (item 4). The boundary-matching allows you to use '^' (starts with), '$' (ends with), both (exact match), or neither (index-of match)...for either the parameter for the value.
Items 1 and 2 enhance the suggestion algorithm in such a way to treat these boundary characters specially. If the '^' character is the first, it will only provide suggestions that start with the characters following it. For example, if you type '^jb' it would offer suggestions like 'jboss...' but not 'apache'.
If the '$' character is the last, it will only provide suggestions that end with the characters that precede it. So if I typed 'abc$' it will offer suggestions like '...abc' but not '...xyz'
Specifically, item 1 enhances the suggestion algorithm for the parameter portion of the search term, and item 2 enhances the suggestion algorithm for the value portion of the search term.
Testing with build 175 of ci-rhq-release job.
Verified boundary matching for parameter suggestions. When I start typing
it suggests for all connection properties in my inventory whose name have a 'j' in it which include,
When I use a boundary matcher for the start of my search parameter as follows,
The suggestions are then filtered down to,
The search execution for what I believe are valid searches results in a hibernate exception. When I execute either of the following,
I get the following exception logged as a JSF message in the UI,
Failed to fetch results: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: unexpected token: AND near line 4, column 484 [SELECT resource FROM org.rhq.core.domain.resource.Resource resource WHERE ( resource.inventoryStatus = :inventoryStatus ) AND ( resource.id IN (SELECT res.id FROM org.rhq.core.domain.resource.Resource res, org.rhq.core.domain.configuration.PropertySimple simple, org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple simpleDefinition JOIN res.resourceType.pluginConfigurationDefinition.propertyDefinitions definition JOIN res.pluginConfiguration.properties property WHERE simpleDefinition = definition AND simpleDefinition.type <> 'PASSWORD' AND property = simple AND AND LOWER(definition.name) LIKE '%jbosshomedir%' AND LOWER(simple.stringValue) LIKE '/home%') ) ]
Moving back to ASSIGNED.
Here is some additional info on the errors in commnent 5.
FROM Resource resource
WHERE ( resource.inventoryStatus = :inventoryStatus )
AND ( resource.id IN (SELECT res.id FROM Resource res, PropertySimple simple, PropertyDefinitionSimple simpleDefinition JOIN res.resourceType.pluginConfigurationDefinition.propertyDefinitions definition JOIN res.pluginConfiguration.properties property WHERE simpleDefinition = definition AND simpleDefinition.type <> 'PASSWORD' AND property = simple AND AND LOWER(definition.name) LIKE 'j%' AND LOWER(simple.stringValue) LIKE '%/usr/java/latest%') )
type=^C gives me the expected suggestions and search results. Seems like the error is limited to when using search parameter names.
Author: Joseph Marques <email@example.com>
Date: Mon Jul 19 12:46:29 2010 -0400
BZ-615017: fix QueryException when using connection-based search terms
* remove duplicate 'AND' token from the generated query
Retesting against build 180 of ci-rhq-release hudson job. The following
now return expected results without error. Marking bug verified.
Mass-closure of verified bugs against JON.