Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 615017 - Support boundary matching for search parameters
Support boundary matching for search parameters
Status: CLOSED CURRENTRELEASE
Product: RHQ Project
Classification: Other
Component: SearchBar (Show other bugs)
3.0.0
All Linux
low Severity medium (vote)
: ---
: ---
Assigned To: Joseph Marques
John Sanda
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-07-15 15:11 EDT by John Sanda
Modified: 2010-08-12 12:44 EDT (History)
1 user (show)

See Also:
Fixed In Version: 2.4
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-08-12 12:44:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Sanda 2010-07-15 15:11:27 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):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Joseph Marques 2010-07-15 15:13:01 EDT
commit 5d75679249ad69455da1a121cb3355ab75dc9629
Author: Joseph Marques <joseph@redhat.com>
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:
    
* value
* context=value
* context[parameter]=value
    
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'
Comment 2 John Sanda 2010-07-16 16:12:03 EDT
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.
Comment 3 Joseph Marques 2010-07-16 23:59:20 EDT
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:

connection[^jboss]=abc$

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.
Comment 4 John Sanda 2010-07-19 08:59:02 EDT
Testing with build 175 of ci-rhq-release job.

Verified boundary matching for parameter suggestions. When I start typing

search: connection[j]

it suggests for all connection properties in my inventory whose name have a 'j' in it which include,

* childJmxServerName
* jar
* javaHomePath
* jbossHomeDir
* jbossWebName
* objectName

When I use a boundary matcher for the start of my search parameter as follows,

search: connection[^j]

The suggestions are then filtered down to,

* connection[jar]
* connection[javaHomePath]
* connection[jbossHomeDir]
* connection[jbossWebName]
Comment 5 John Sanda 2010-07-19 09:11:09 EDT
The search execution for what I believe are valid searches results in a hibernate exception. When I execute either of the following,

search: connection[jbossHomeDir]=/home/jsanda/Development/jboss/jon/rhq-server-3.0.0-SNAPSHOT/jbossas

search: connection[jbossHomeDir]=^/home

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.
Comment 6 John Sanda 2010-07-19 09:15:43 EDT
Here is some additional info on the errors in commnent 5.

search: connection[^j]=/usr/java/latest

jpql:
SELECT resource
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%') )
Comment 7 John Sanda 2010-07-19 09:24:39 EDT
type=^C gives me the expected suggestions and search results. Seems like the error is limited to when using search parameter names.
Comment 8 Joseph Marques 2010-07-19 13:13:45 EDT
commit d487e3959c4e6f0860816a3900b3caf253752962
Author: Joseph Marques <joseph@redhat.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
Comment 9 John Sanda 2010-07-21 11:30:40 EDT
Retesting against build 180 of ci-rhq-release hudson job. The following

search: connection[^]=/usr/java/latest
search: connection[jbossHomeDir]=^/home

now return expected results without error. Marking bug verified.
Comment 10 Corey Welton 2010-08-12 12:44:18 EDT
Mass-closure of verified bugs against JON.

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