Bug 610120 - Search: do not override user-chosen quoting style
Summary: Search: do not override user-chosen quoting style
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: SearchBar   
(Show other bugs)
Version: 3.0.0
Hardware: All Linux
low
medium vote
Target Milestone: ---
: ---
Assignee: Joseph Marques
QA Contact: John Sanda
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-07-01 15:27 UTC by Joseph Marques
Modified: 2010-08-12 16:51 UTC (History)
0 users

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


Attachments (Terms of Use)

Description Joseph Marques 2010-07-01 15:27:49 UTC
When a user enters a search, it will provide simple suggestions.  Since these suggestions may contain whitespace, all of them are blindly wrapped with double-quotes so that, upon auto-complete, the search translator will interpret multiple words as a single search token.  However, this strategy is imperfect.

If the user starts the search term with a single-quote, selecting a search suggestion will override that first character with a double-quote instead.  Aside from this being unexpected, this may create an invalid search expression.  If the item being suggested as a double quote in it, then the boundary characters need to be single-quote to properly treat the inner double-quote character as a literal part of the search term.

Use case:

* user types <'foo> (without angled brackets)
* suggestions are rendered below the search bar
* user selects <foo "bar" howdy> (without angled brackets) from the list

Expected result: Search is replaced with 'foo "bar" howdy', which properly interprets the double-quotes as a literal part of the search term and will search for <foo "bar" howdy> (without angled brackets)

Actual result: Search is replaced with "foo "bar" howdy", which upon parsing is interpreted as an invalid expression.  It finds the first search term, <foo > (notice the presented whitespace), but then interprets the rest of the expression as invalid because whitespace does not separate the second double-quote character from <bar>.  The net effect is that the entire search expression is treated as invalid, and no filtering is performed.

Comment 1 Joseph Marques 2010-07-15 15:12:09 UTC
commit f3fa4486e9c1b359fd9cb8b73f824630bc1430ee
Author: Joseph Marques <joseph@redhat.com>
Date:   Thu Jul 15 11:10:38 2010 -0400

BZ-610120: respect user-chosen quoting style
    
* if user starts with single-quote, offer suggestions wrapped with single-quotes
* in all other cases, offer suggestions wrapped with double-quotes

Comment 2 John Sanda 2010-07-19 15:18:54 UTC
Testing with build 175 of ci-rhq-release job.

scenario 1
-----------
resource name: my " broken job

Started search by typing <'my> (without angle brackets). My resource name appears in the suggestions and in the results. The single quotes on the search string are preserved as well.

Started search by typing <"my>. My resource name appears in the suggestions. I select the suggestion, and the pattern in the search is correctly converted to use single quotes - 'my " broken job'.


scenario 2
-----------
resource name: my ' broken job

Started search by typing <"my>. My resource name appears in the suggestions and in the results. The double quotes on the search string are preserved as well.

Started search by typing <'my>. My resource name appears in the suggestions. I select the suggestion, and the pattern in the search is correctly converted to use double quotes.

scenario 3
-----------
resource name: 'my "broken" job'

Started search by typing <'my>. My resource name appears in the suggestions and in the search results. The single quotes on the search string are preserved as well.

Started search by typing <"my>. My resource name appears in the suggestions. I select the suggestion, and the pattern in the search is converted to use single quotes - 'my "broken" job'.

scenario 4
-----------
resource name: "my 'broken' job"

Started search by typing <'my>. My resource name appears in the suggestions. I select the suggestion, and the search pattern is converted to outer double quotes - "my 'broken' job".

Started search pattern by typing <"my>. The resource name appears in the suggestions and in the search results. The search pattern does not get changed.

Comment 3 Corey Welton 2010-08-12 16:51:12 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.