Bug 243495

Summary: [api] New: Allow file name search in Remote Search to not be case sensitive
Product: [Tools] Target Management Reporter: Samuel Wu <samuelwu>
Component: RSEAssignee: David McKnight <dmcknigh>
Status: RESOLVED FIXED QA Contact: Martin Oberhuber <mober.at+eclipse>
Severity: enhancement    
Priority: P3 CC: mkomor
Version: 3.0.1Keywords: api
Target Milestone: 3.1 M7Flags: mober.at+eclipse: pmc_approved+
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
api changes required
none
patch with support for controlling file name search case sensitivity
none
patch using true as the default none

Description Samuel Wu CLA 2008-08-07 17:00:14 EDT
Build ID: org.eclipse.rse.core_3.0.1.v20080626-7Z377EB7sQS9RqhIE7MU

Steps To Reproduce:
During the remote search, we were searching for string "test" with the file name pattern as "clp*". The search result only contains hits in file started with clp. Some files start with CLP also contains the string and were not among the search result.

More information:
Comment 1 David McKnight CLA 2009-03-23 13:25:15 EDT
This would require an API change in SystemSearchString (i.e. to include an isFileNamesCaseSensitive boolean).  It's too late for API changes in RSE 3.1.
Comment 2 Martin Oberhuber CLA 2009-03-23 19:43:42 EDT
We currently have ISubSystemConfiguration.isCaseSensitive() to switch case sensitivity on a global level. Would that be sufficient here, or is the request really to search case insensitive on a file system / subsystem that's actually marked as case sensitive?

Note that when we globally switch to case insensitive, client will e.g. get back
   FOO, Foo, FoO
and can perform second-level filtering on those results (without API change) if it really wants them case sensitive.
Comment 3 David McKnight CLA 2009-03-24 12:38:23 EDT
(In reply to comment #2)
> We currently have ISubSystemConfiguration.isCaseSensitive() to switch case
> sensitivity on a global level. Would that be sufficient here, or is the request
> really to search case insensitive on a file system / subsystem that's actually
> marked as case sensitive?
> 
> Note that when we globally switch to case insensitive, client will e.g. get
> back
>    FOO, Foo, FoO
> and can perform second-level filtering on those results (without API change) if
> it really wants them case sensitive.
> 

I think the request is to have an option (i.e. a checkbox in the search page) to search case-insensitive on a case-sensitive file system.  So if a file system contains FOO, Foo, and FoO, the user has the choice of searching for "Foo" 
(1) via a case-sensitive search, resulting in "Foo"
or
(2) via a case-insensitive search, resulting in "FOO", "Foo" and "FoO"
 
Comment 4 David McKnight CLA 2009-03-24 15:07:01 EDT
Created attachment 129742 [details]
api changes required

I think this would be the only API change.
Comment 5 Martin Oberhuber CLA 2009-03-24 15:15:01 EDT
API change looks good to me, I'm fine with this for M7.

I'm a bit surprised why you want the isFileNamesCaseSensitive field to be protected rather than private, but the others are protected too so that's OK for me.

BTW, a workaround without any change might be to use a REGEX thats case insensitive, i.e. convert any case insensitive search into a REGEX using Java's specifier for matching case insensitive. 

If the user specifies the proper case insensitive regex in the UI, this should work in RSE today.
Comment 6 David McKnight CLA 2009-03-24 16:22:25 EDT
Created attachment 129756 [details]
patch with support for controlling file name search case sensitivity
Comment 7 David McKnight CLA 2009-03-25 16:24:19 EDT
I've committed the patch to cvs.
Comment 8 Martin Oberhuber CLA 2009-04-20 08:21:55 EDT
I notice that the default (and old RSE 3.0 behavior) is to perform searches case sensitive == true.

But in SystemSearchPage, DialogSettings are stored and a new slot ("isCaseSensitive") is used in those DialogSettings. If I run RSE 3.1 on and old RSE 3.0 workspace, then the DialogSettings won't have the new slot, so it falls back on its default value (isCaseSensitive = false).

This is different than the expected RSE 3.0 behavior of isCaseSensitive = true.

This may not be an issue since searching case insensitive is generally preferred over searching case senstivie since more matches are returned. Anyways, I'd like you to think again whether this is indeed what you want.
Comment 9 David McKnight CLA 2009-04-20 14:22:50 EDT
Created attachment 132472 [details]
patch using true as the default

To preserver the default 3.0 behaviour this patch should assume case-sensitive when no value is set. Martin, is this what you had in mind?
Comment 10 Martin Oberhuber CLA 2009-04-22 15:35:57 EDT
Yes, this patch looks good. Thanks!
Comment 11 David McKnight CLA 2009-04-22 15:52:39 EDT
Okay, I've committed the change to cvs.