Feature request #9493

Filter improvements

Added by Jonathan Moules over 6 years ago. Updated over 6 years ago.

Status:Closed
Priority:Normal
Assignee:Etienne Tourigny
Category:Browser
Pull Request or Patch supplied:No Resolution:
Easy fix?:No Copied to github as #:18084

Description

There are a number of simple improvements that I believe can be made to the Browser filter function to make it more useable:

a) By Default wildcards should be placed at the start and end of all search terms automatically. Maybe add this as a new "default" search called "Normal".

b) By Default make it case-insensitive. If necessary add a checkbox for "match case", but it should be unchecked by default.

The current behaviour for both of these is extremely non-obvious and I almost reported a bug saying that the filter wasn't working. Both of these are the default for most search functions in most applications I can think of, including ironically, the filters in the WFS and Oracle add-data dialogs.

Associated revisions

Revision ececdb71
Added by Etienne Tourigny over 6 years ago

browser dock search: add normal syntax (with wildcards at begin and end) and case insensitive search, both default (implements #9493)

History

#1 Updated by Etienne Tourigny over 6 years ago

  • Assignee set to Etienne Tourigny

Hi,

when I implemented the filter functionality I did things as simple as possible, using QT's QRegexp [1] class with minimal work (basically passing the search string to QRegExp).

The "Wildcard" option uses QRegExp::Wildcard PatternSyntax (defined in [2]) and the "Regular Expression" option uses QRegExp::RegExp.
Also, when using the "Wildcard" option, you can use | to separate search strings.

Note that this was implemented with files in mind, which is where it is most useful (imagine a directory of 1000s of files).

Your suggestions are valid. The behavior is different from WFS and Oracle add-data dialogs simply because they were implemented by different people.
I come from the Linux world, and find it normal to specify wildcards in the beginning and end if need be.

What would your suggestion for "Normal" search? Should wildcards like * and ? be permitted inside the string? or just a simple string with wildcards at beginning and end?

Case-insensitive search should have an option, it would be ok to have it case-insensitive by default.

[1] http://qt-project.org/doc/qt-4.8/qregexp.html
[2] http://qt-project.org/doc/qt-4.8/qregexp.html#PatternSyntax-enum

#2 Updated by Etienne Tourigny over 6 years ago

see my implementation here with commit "browser dock: add normal syntax (with wildcards at begin and end) and case insensitive search, both default"

https://github.com/etiennesky/Quantum-GIS/tree/browser_search

If satisfactory I will add to master after 2.2 is out

#3 Updated by Jonathan Moules over 6 years ago

Hi Etienne,
Don't get me wrong, the current implementation is good for power users, but most users aren't that technical (there's a reason Linux has a low % of the home-users market ;-) ), hence my suggestion.

I'd suggest the default behaviour should be the same as a web-browser search (when you Ctrl-F). I think no wildcards from the user, at least not in the default search. There are current two search functions (Wildcards, Regexp). I'd suggest a third "Normal" which is the default and has this specified behaviour. Then you don't need to change the other two (except probably the case insensitive checkbox).

I'm afraid I'm not a dev so can't look at a commit and have any clue what it'll do.

And thanks for the prompt response!

#4 Updated by Etienne Tourigny over 6 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF