Bug 615017 - Support boundary matching for search parameters
Summary: Support boundary matching for search parameters
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: SearchBar
Version: 3.0.0
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
: ---
Assignee: Joseph Marques
QA Contact: John Sanda
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-07-15 19:11 UTC by John Sanda
Modified: 2010-08-12 16:44 UTC (History)
1 user (show)

Fixed In Version: 2.4
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-08-12 16:44:18 UTC
Embargoed:


Attachments (Terms of Use)

Description John Sanda 2010-07-15 19:11:27 UTC
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 19:13:01 UTC
commit 5d75679249ad69455da1a121cb3355ab75dc9629
Author: Joseph Marques <joseph>
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 20:12:03 UTC
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-17 03:59:20 UTC
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 12:59:02 UTC
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 13:11:09 UTC
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 13:15:43 UTC
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 13:24:39 UTC
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 17:13:45 UTC
commit d487e3959c4e6f0860816a3900b3caf253752962
Author: Joseph Marques <joseph>
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 15:30:40 UTC
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 16:44:18 UTC
Mass-closure of verified bugs against JON.


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