Bug 179012 - advanced search missing negative conditions (changed from 0.9)
Summary: advanced search missing negative conditions (changed from 0.9)
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Searches-Advanced (show other bugs)
Version: 0.10.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-29 02:41 UTC by kilrae
Modified: 2017-08-18 06:29 UTC (History)
2 users (show)

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


Attachments
Default labels (41.12 KB, image/png)
2009-01-09 16:54 UTC, Marcel Wiesweg
Details
Labels for negation (38.40 KB, image/png)
2009-01-09 16:55 UTC, Marcel Wiesweg
Details
With all four options shown (45.09 KB, image/png)
2009-01-09 17:32 UTC, kilrae
Details
Default view of first group header (66.73 KB, image/png)
2009-01-10 23:25 UTC, Marcel Wiesweg
Details
Showing the options (81.58 KB, image/png)
2009-01-10 23:28 UTC, Marcel Wiesweg
Details
Put options in two lines as suggested (39.31 KB, image/png)
2009-01-10 23:58 UTC, Marcel Wiesweg
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kilrae 2008-12-29 02:41:51 UTC
Version:           0.10b7 (using Devel)
OS:                Linux
Installed from:    Compiled sources

You can no longer search negative conditions using the advanced search.

In 0.9 you were able to specify a condition like "tag name does not contain outdoors" but in the new dialog in 0.10 this is missing. You can only search on positive conditions ("tag name contains outdoors").

I marked it as a bug because it's not a new feature request, it's an old feature that was apparently left out when the dialog was redesigned.
Comment 1 kilrae 2008-12-29 03:02:08 UTC
It appears you can add a second search group joined with an "and not" operator to work around this. It's a silly workaround though. That means your first search group has to be a dummy search (returns everything so it can be limited by the second one).

A better solution would be to add a third option to the top so you would have: "Match all of these conditions", "Match any..." and "Match none...". Or four options to cover every situation ("Any" "All" "Not any" "Not all"). Or two options and a negate button. If you did that, you wouldn't need the "and not" operator between groups. You'd just need "and" and "or" which would probably make more sense anyway.

So the dialog would look something like this:

Find photos that:

*Start Group*
( ) Match all of these conditions
( ) Match any of these conditions
( ) Do not match any of these conditions
( ) Do not match all of these conditions

File/Album/Tags >
Picture Properties >
Caption >
Photo information >
*End Group*

And/Or

*Begin group*
...
*End group*
Comment 2 Marcel Wiesweg 2008-12-29 14:23:23 UTC
Not allowing "NOT" here was done to limit UI complexity, but I am beginning to agree with adding some better way to express "NOT", as the discoverability of the add-second-search-group solution is not good.
If we add an option after the "Match all/Match any" I would prefer it to be only one.
Any viewpoints on that?

I have a problem here with the language: "Do not match all" can mean "Match only some".
We have currently:

Match all = A && B && C
Match any = A || B || C

Putting a "NOT" in front of this leads us to logical NAND and NOR.
We can express that in English if there are only two values using deMorgan's rules:
NOT match all = !(A && B) = !A || !B = Either A or B do not match
NOT match any = !(A || B) = !A && !B = Neither A nor B match

But what about n>2?
NOT match all = !(A && ... && Z) = !A || ... || !Z = ?
NOT match any = !(A || ... || Z) = !A && ... && !Z = ?
Which of these is "Do not match any"?
Comment 3 Mikolaj Machowski 2008-12-29 17:43:15 UTC
+1 for adding this option.

And maybe even two options as you described them?
Comment 4 kilrae 2008-12-30 00:14:47 UTC
1. All of these conditions are met: (A && B && C)
2. Any of these conditions are met: (A || B || C)
3. At least one of these conditions is not met: !(A && B && C), (!A || !B || !C)
4. None of these conditions are met: !(A || B || C), (!A && !B && !C)
Comment 5 Michael Skiba 2009-01-07 17:43:07 UTC
We could also add another search, which behaves exactly like the old logical one:
simple, advanced, logical/complexe 
(I know it could be a bit confusing)
Comment 6 Marcel Wiesweg 2009-01-09 16:54:15 UTC
See the two following screenshots. The label is clickable and switches between positive and negated conditions.
Input on layout is welcome, and a native speaker's opinion on the wording, especially "invert", is most welcome.
Comment 7 Marcel Wiesweg 2009-01-09 16:54:50 UTC
Created attachment 30057 [details]
Default labels
Comment 8 Marcel Wiesweg 2009-01-09 16:55:12 UTC
Created attachment 30058 [details]
Labels for negation
Comment 9 kilrae 2009-01-09 17:31:35 UTC
"Invert" is the only thing I have trouble with since elsewhere in the interface invert is used differently (xox becomes oxo). I'd suggest "negate" but I'm not sure most people would be comfortable with the term.

What if you put "More options" and clicking on that displayed all four at once:

( ) All
( ) Any   [More Options]

Click:

( ) All   ( ) At least one not
( ) Any   ( ) None

See following mock-up
Comment 10 kilrae 2009-01-09 17:32:44 UTC
Created attachment 30061 [details]
With all four options shown

You could hide the two negative conditions by default to simplify things.
Comment 11 kilrae 2009-01-09 17:35:07 UTC
In my mockup, I cut out the "Meet" part from Marcel's screenshots, but I realize now that it's necessary (although a space is needed).
Comment 12 Michael Skiba 2009-01-09 17:45:20 UTC
hm.. the screen itself looks nice (although I'm not sure if my granny would understand "Invert" right from the start..)

But in my opinion it's still not equal, now we've an either or solution, different, but not better.

Imaging I've a large collections of e.g. churches or something like that, let's say I want to find all pictures in the album 'Paris' that have the tag 'church', but I don't want the ones which are catholic. (I guess this example works better on a person-tagging-scheme)

I want all pictures of my daughter(tag), from vacation 08 (album), but exclude all that have a tag "private" and remove all those who have a tag "pictureframe". (I often use this tagging scheme when presenting pictures to the family and want to avoid those pictures were you look really funny, while lying exhausted on the couche etc.).

Another example could be exclude a certain day of the vacation or something like this, I think you all got the idea of what mixed conditions are useful for.


I realized that the search is actually good to find a specific picture (what it's actually intended to do), maybe the thing I'm/we're looking for is more of a filter function (if you wanna seperate the etymology)

So I've two ideas:
1.) Extend the current search interface (which looks pretty nice btw.), and put a plus and a minus sign behind each searchoption and clicking on one of them would add them to a "list" (As a sideeffect would have more flexibility, i.e. making it possible to search for two different timeframes [ from 23.12.07 to 27.12.07 AND 23.12.08 to 27.12.08 ]

This would be pretty much do the same stuff the old search did, but having the advantage of more details and an easier interface as the old one has (at least some say so ...)

2.) Implement this 'logical search' as a filter, in a seperate way/view/window in digiKam.
Comment 13 kilrae 2009-01-09 18:55:35 UTC
You can do this, you just add another option group with a different matching condition. So you can have:

Match all:
tags: paris, church
- AND -
Match none:
tags: catholic

The four matching conditions apply only to the immediately following group, when you click "add option group" you get to choose one of the four matching conditions again.
Comment 14 Mikolaj Machowski 2009-01-09 19:48:50 UTC
"Reverse conditions"? Just suggestion.

Shouldn't be "negative" conditions reversed?

"None of these conditions" is IMO opposite of "All of the following conditions"
and should be first.

Also like four-in-one solution. But I have specific taste and like complex UIs where all options are directly accessible which is not newbie friendly.
Comment 15 Marcel Wiesweg 2009-01-10 23:25:15 UTC
Created attachment 30113 [details]
Default view of first group header

This is the second revision of the group header.
There is a link on the right "Options >>" which gives the view as in the next screenshot.
For this view, I could imagine some artwork blended below the text as it is now.
Comment 16 Marcel Wiesweg 2009-01-10 23:28:01 UTC
Created attachment 30114 [details]
Showing the options

At the top, you see the first group header when the "Options >>" label is clicked. The options are opened automatically if any other but the first option is selected.
In the lower part you see the header of an added, second group. Here there is no show/hide options label, the options are always there. As well I removed the combo box for AND/OR, you can just click on the label to toggle.
Comment 17 kilrae 2009-01-10 23:32:31 UTC
Is it not possible to get them onto two lines as in my mockup? There certainly seems to be enough space given the size of the field underneath. There should maybe be some indication that "Meet all" is the default before you click show options.
Comment 18 Marcel Wiesweg 2009-01-10 23:58:03 UTC
Created attachment 30117 [details]
Put options in two lines as suggested
Comment 19 Mikolaj Machowski 2009-01-11 23:52:54 UTC
Looks nice. BTW why not just dropdown list?
Comment 20 Marcel Wiesweg 2009-01-13 15:39:02 UTC
SVN commit 910536 by mwiesweg:

Offer options for negative search conditions in the search group header.
We offer four different options:
1) All of these conditions are met: (A && B && C)
2) Any of these conditions are met: (A || B || C)
3) At least one of these conditions is not met: !(A && B && C), (!A || !B ||!C)
4) None of these conditions are met: !(A || B || C), (!A && !B && !C)
with 1) being the default.
Intuition and UI wording of the negated versions use the (!A || !B ||!C) and (!A && !B && !C)
variant, while the stored search XML and the generated SQL will use !(A && B && C) and
!(A || B || C) according to de Morgan. This explains why the code is a bit more
complicated than I expected initially.

BUG: 179012

 M  +223 -20   searchgroup.cpp  
 M  +21 -1     searchgroup.h  
 M  +20 -0     searchview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=910536