Bug 345719 - Enhance fast search/filter on lists
Summary: Enhance fast search/filter on lists
Status: RESOLVED FIXED
Alias: None
Product: skrooge
Classification: Applications
Component: general (other bugs)
Version First Reported In: unspecified
Platform: Kubuntu Linux
: NOR wishlist
Target Milestone: 25.1.0
Assignee: Stephane MANKOWSKI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-31 09:58 UTC by vicnet
Modified: 2015-04-03 19:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vicnet 2015-03-31 09:58:53 UTC
Allow to fast search/filter items on lists (like operations) on specific a column only.
For example, filter (diplay) only operation that contains 'thing' only in comment. A operation with 'thing' on payee wil not be displayed.

I suggest to use column:text format, with ':' separator, to restrict search on a specific column.
'column' is a column name or the begining of a column name.
For example, to search only in Comment, 'co:text' will be enough.
Which column to use if column name correspond to multiple columns ?

To backward compatibility, I suggest to allow quote (single and double) on search string. "c:text" will search c:text on all columns.
This also allow to search with + and - char (normally used to refine search terms) and moreover to allow search with space: "text text" with search only this string without cutting the string in two OR search.

Reproducible: Always

Steps to Reproduce:
1. enter column:text in search/filter box on lists

Actual Results:  
filter row that contains column:text on all columns

Expected Results:  
filter row that contains text on all columns that name starts with 'column'

See discussion on https://forum.kde.org/viewtopic.php?f=210&t=125653&p=332073#p332073
Comment 1 vicnet 2015-03-31 10:14:54 UTC
I suggest to modify SSKGServices::KGSearchCriteria to add a 'QString column' (peharps too specific or columnName (even more precise) or name (more generic).

SKGServices::stringToSearchCriterias will fill list of criteria with this rules:
- if quote (single or double), take all chars without analyse until end of quote, and remove quote
- if ':' char, split string and fill column data
- +/- chars are analysed as before

In SKGSortFilterProxyModel::filterAcceptsRowWords (and in others sources where criteria is used), compare criteria column name (if exists) with column name (in header) before checking text.
Comment 2 vicnet 2015-03-31 12:46:16 UTC
After reviewing current code, I discover that +/- chars define OR condition search and spaces define AND.
Example:
  +abc +def => abc somewhere OR def somewhere
=> 2 criterias, 1 word each
  +abc def => abc somewhere AND def somewhere
=> 1 criterias, 2 words
So I think 'column' data should be associated with word and not criteria.
criteria:
- type
- list of:
  . word
  . column
Comment 3 Stephane MANKOWSKI 2015-03-31 20:54:10 UTC
Git commit c0270dfbbf0bd211684d4713a6ec825ffd75a4fb by Stephane Mankowski.
Committed on 31/03/2015 at 20:53.
Pushed by smankowski into branch 'master'.
Enhance fast search/filter on lists

M  +1    -0    CHANGELOG
M  +2    -0    TODO
M  +3    -0    skgbasegui/skgfilteredtableview.ui
M  +15   -3    skgbasegui/skgsortfilterproxymodel.cpp
M  +2    -2    skgbasemodeler/skgservices.cpp
M  +20   -0    tests/skgbasemodelertest/skgtestbase.cpp

http://commits.kde.org/skrooge/c0270dfbbf0bd211684d4713a6ec825ffd75a4fb
Comment 4 Stephane MANKOWSKI 2015-03-31 20:55:12 UTC
Hi vicnet,

Could you test it and reopen this bug if you are not satisfied by the developement?

Regards,
Stephane
Comment 5 vicnet 2015-04-01 11:24:20 UTC
All is fine except use of quotes. For spaces, it is OK.
But I expect that "e:" (with quotes) filter lines that contains really the two chars 'e' + ':'.
In fact, quote are removed before ':' test so "e:" is interpreted as e: so it not filter any line as word after ':' are empty...
I think SSKGServices::KGSearchCriteria should deals with separator manipulation... and not ProxyModel.

Peharps add some 'hints' also in tip of the day.

Tooltip is not condensed as other tooltips.
Lines/Phrases are separated by some spaces. Not a big pb but disgracefull...
Comment 6 Stephane MANKOWSKI 2015-04-01 14:26:23 UTC
Git commit f80ea56a5546d8419f25e55ce1bfec843e0c4488 by Stephane Mankowski.
Committed on 01/04/2015 at 14:26.
Pushed by smankowski into branch 'master'.
Enhance fast search/filter on lists

M  +17   -4    doc/index.docbook
M  +1    -1    skgbasegui/skgfilteredtableview.ui
M  +4    -2    tests/skgbasemodelertest/skgtestbase.cpp

http://commits.kde.org/skrooge/f80ea56a5546d8419f25e55ce1bfec843e0c4488
Comment 7 Stephane MANKOWSKI 2015-04-01 14:29:38 UTC
Hi vicnet,

I don't want to complexify too much the code.
I updated the tooltip.
As you can see, if you want to search "e:f" on all attributes you have to enter ":e:f" (without cotes).

I have a question:
The optional character ":" is used to mean "containing", what do you thing if we add the support of ">" or "<" ?
Comment 8 vicnet 2015-04-01 16:26:21 UTC
">" and "<" for real number comparisons ? Or different signification (instead ':' char) ?
Comment 9 Stephane MANKOWSKI 2015-04-01 16:34:59 UTC
In fact "<" and ">" could be use to compare numbers, dates, string.

For example:
amount>50 will keep operations having greater than 50.
date>2015-01-01 will keep operations since 1st Jan 2015.
Comment 10 vicnet 2015-04-01 19:39:49 UTC
Oh yes I see.
And I like this because it is a generalization of ':', sort of "column operator word" with different operators like ':', '>', '<'...

Currently ':' is 'contains'
'=' could be exactly equal
'>', '<' as you said
...
Comment 11 Stephane MANKOWSKI 2015-04-02 20:46:50 UTC
Git commit 2aaaafd99d7ddd8a0e0b77db1886b843e79fb2c8 by Stephane Mankowski.
Committed on 02/04/2015 at 20:42.
Pushed by smankowski into branch 'master'.
Enhance fast search/filter on lists

M  +8    -5    doc/index.docbook
M  +1    -1    skgbasegui/skgfilteredtableview.ui
M  +94   -34   skgbasegui/skgsortfilterproxymodel.cpp
M  +3    -0    skgbasegui/skgsortfilterproxymodel.h

http://commits.kde.org/skrooge/2aaaafd99d7ddd8a0e0b77db1886b843e79fb2c8
Comment 12 Stephane MANKOWSKI 2015-04-02 20:48:14 UTC
Could you try it?
Examples:
Amou>100
Date>2015-03-25
Comment 13 Stephane MANKOWSKI 2015-04-03 19:14:09 UTC
Git commit 62e5a687dd6b4555824f786add4e1a1d941f3c49 by Stephane Mankowski.
Committed on 03/04/2015 at 18:19.
Pushed by smankowski into branch 'master'.
Enhance fast search/filter on lists

M  +1    -0    doc/index.docbook
M  +1    -1    skgbasegui/skgfilteredtableview.ui
M  +1    -1    skgbasemodeler/skgservices.cpp
M  +2    -2    tests/skgbasemodelertest/skgtestbase.cpp

http://commits.kde.org/skrooge/62e5a687dd6b4555824f786add4e1a1d941f3c49