Bug 1062351 - [RFE] Search mechanism doesn't handle particular special characters well
Summary: [RFE] Search mechanism doesn't handle particular special characters well
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RFEs
Version: ---
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: ovirt-3.6.0-rc
: 3.6.0
Assignee: Eli Mesika
QA Contact: Pavel Novotny
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-02-06 17:29 UTC by Pavel Novotny
Modified: 2016-02-02 10:35 UTC (History)
8 users (show)

Fixed In Version: ovirt-engine-3.6.0-0.0.master.20150412172306.git55ba764
Clone Of:
Environment:
Last Closed: 2016-02-02 10:35:52 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-3.6.0+
ylavi: planning_ack+
rule-engine: devel_ack+
pstehlik: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 38490 0 master MERGED core: add support for special chars in search Never

Description Pavel Novotny 2014-02-06 17:29:08 UTC
Description of problem:
Entities (like DCs, VMs, templates, ...) with special character in the description or comment cannot be found according to it. 

Version-Release number of selected component (if applicable):
ovirt-engine-3.4.0-0.5.beta1.el6.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create a DC (or cluster, storage, VM,...) with special character(s) in the description.
   By special characters it's meant: !#^&<>;"'
2. Search the DC by description using one of the special characters in the search query, i.e.,
   Datacenter: description = "#"
   -- or with wildcards --
   Datacenter: description = "*#*"
3. 

Actual results:
The search result is empty.
In the engine.log you'll find a warn message, but no warning appears in the UI (Webadmin) - nothing in the bottom Events panel nor anywhere else. 

engine.log:
2014-02-06 17:45:01,825 WARN  [org.ovirt.engine.core.bll.SearchQuery] (ajp--127.0.0.1-8702-11) ResourceManager::searchBusinessObjects - erroneous search text - Datacenter: description = "*#*"


Expected results:
Special characters should be treated as plain strings so DC from step 1 is returned.


Additional info:
Three more characters are problematic:
1. '\' character is ignored when searching (I guess the search backend filters it out from the search query)
2. there is no way how to search the '*' character, because it's used as the wildcard character
3. '%' character is interchangeable with '*' so you cannot search for it neither

Comment 1 Martin Pavlik 2014-02-20 15:05:45 UTC
There is also no way how to search for items which do not have certain field filled at all.

For example I want to see all network which do not have a any label

Search: 
Network: label = ""
does not work

nor does 
Network: label != "*"

Comment 2 Eli Mesika 2014-02-20 21:09:53 UTC
(In reply to Martin Pavlik from comment #1)
> There is also no way how to search for items which do not have certain field
> filled at all.
> 
> For example I want to see all network which do not have a any label
> 
> Search: 
> Network: label = ""
> does not work
> 
> nor does 
> Network: label != "*"

I agree, more accurate handling IMHO will be to support special values NULL and EMPTY_STRING to enable that and this worth a special RFE that will probably enable us to handle it before this RFE since it is less complex.

So, if you have no objection, please  open a different RFE on that

Comment 3 Martin Pavlik 2014-02-21 07:26:30 UTC
Done, opened bug 1067844

Comment 4 Eli Mesika 2014-08-31 13:27:48 UTC
I had investigated it and its origin is in BaseConditionFieldAutoCompleter::isValid(String field, String value)
This method is called from various value types detection and disallow any char of : {^,<,>,&,#,!,;}

I think that this method is redundant, when we have a string value we should allow all
I had checked returning true from BaseConditionFieldAutoCompleter::isValid(String field, String value) and it worked perfectly 

Yair, do we have any problem having those characters in AD search ?

Comment 5 Yair Zaslavsky 2014-09-01 02:12:50 UTC
(In reply to Eli Mesika from comment #4)
> I had investigated it and its origin is in
> BaseConditionFieldAutoCompleter::isValid(String field, String value)
> This method is called from various value types detection and disallow any
> char of : {^,<,>,&,#,!,;}
> 
> I think that this method is redundant, when we have a string value we should
> allow all
> I had checked returning true from
> BaseConditionFieldAutoCompleter::isValid(String field, String value) and it
> worked perfectly 
> 
> Yair, do we have any problem having those characters in AD search ?

& and ! are used in the ldap query language.

You can see here a list of characters that need t boe escaped -

http://docs.oracle.com/javase/jndi/tutorial/beyond/names/syntax.html

<   >   #  ;   are among these characters.

Comment 6 Pavel Stehlik 2016-02-02 10:35:52 UTC
Closing older BZs, if still happened, please reopen.


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