Bug 147426 - Search for non-voted pics
Summary: Search for non-voted pics
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Searches-Labels (show other bugs)
Version: 0.9.1
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-01 20:39 UTC by Warren Werner
Modified: 2017-08-18 09:42 UTC (History)
1 user (show)

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


Attachments
also find never rated images (1.40 KB, patch)
2007-08-31 21:12 UTC, Arnd Baecker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Warren Werner 2007-07-01 20:39:55 UTC
Version:           0.9.1 (using KDE 3.5.6, Kubuntu (feisty) 4:3.5.6-0ubuntu14)
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.20-16-generic

It should be possible to make a filter in the Image search to look for pictures which have no vote. If You look for 0-star-pictures, you get only these, which are maually set to zero, but not these, which are not set at all. 

Bitte macht einen Filter für nicht bewertete Bilder!
Comment 1 Arnd Baecker 2007-07-02 00:44:26 UTC
You are talking about setting up an advanced search, right?

For this I just tried to reproduce your problem, but with current svn 
everything seems to work as expected.

Could you try with 0.9.2 (packages for feisty are already available)
and see if the problem persists?

Many thanks in advance, 
Arnd
Comment 2 Warren Werner 2007-07-06 12:08:35 UTC
Now I installed v 0.9.2-final and the problem persists. 
I have an Album with 12 pictures, most of them with 0 stars. If I set in the advanced search the rules: 
Album = Twelve-Pictures
AND
Voting >= 0
I get only 4 Pictures, which first I gave 5 stars and then set to 0 and 1 pic with 4 stars. 
Similar result I get with the variations
Voting <= 0 (same result without the 4-star-pic); Voting = 0 (same result without the 4-star-pic).

I hope not to be too confusing. The thing I wanted to say: The problem is not resolved in 0.9.2-final
Comment 3 Arnd Baecker 2007-07-06 12:44:08 UTC
Josef, you are right, now I can reproduce the problem
(not sure why I did not see it last time.
As far as I understand things, the origin of the problem is the following
search sent to the sql database

SELECT Images.id, Images.name, Images.dirid, Images.datetime, Albums.url
FROM Images, Albums LEFT JOIN ImageProperties ON Images.id =
Imageproperties.imageid WHERE (  (Images.dirid IN   (SELECT id FROM Albums
WHERE url LIKE '%Star%'))  AND  (ImageProperties.value >= '0' and
ImageProperties.property='Rating')  )  AND (Albums.id=Images.dirid);

I think that whenever an item has not yet been rated at all, ImageProperties.property='Rating' does not exist.
Setting it to some value and back to 0 creates that field in the
database so that the above AND is fulfilled.
So whenever, ImageProperties.value >= '0' or ImageProperties.value = '0'
or ImageProperties.value <= '0' is asked for, it should be presumably
something like (symbolically)

 AND ( (ImageProperties.value >= '0' and ImageProperties.property='Rating') 
       OR  (there_is_no ImageProperties.property='Rating') )

Marcel, I think a database expert is needed here ...;-) 
(i.e., can one do this somehow?)

Another option would be to define all images in the database
with rating=0...
Comment 4 Arnd Baecker 2007-08-31 17:38:54 UTC
Marcel, 

is there a way to setup a query so that images which have not been
rated before can be found as well?
If you could give me some hints, I would try to solve this here.

Best, Arnd
Comment 5 Marcel Wiesweg 2007-08-31 18:47:36 UTC
This could work:

WHERE Images.id NOT IN (SELECT imageid FROM ImageProperties WHERE property='Rating');

Don't know if there is something more elegant.
Comment 6 Arnd Baecker 2007-08-31 21:12:24 UTC
Created attachment 21518 [details]
also find never rated images 

The attached patch modifies the rating search such
that also never rated images are found on a search for 
- rating=0 
- rating>=0
- rating<=0
- rating<c    (with c=1,2,3,4,5)
- rating<=c
- rating<>c

My test cases work fine, but it would be good if someone else
could check this patch!
Comment 7 caulier.gilles 2007-09-08 12:14:45 UTC
Josef,

Are you tried patch provided by Arnd ?

Gilles
Comment 8 Warren Werner 2007-09-08 15:07:43 UTC
I did not manage to install digikam from source since i have already installed a version. 

But a general Question: 

Isn't it useful if it is possible to differ between non-voted-0-star and voted-0 star (very ugly pic)?

Maybe it was better to add an option to choose non-voted-pics or to include them. But also this brings problems With it. Mybe it is better to define 1-star-pics as ugly and 0-star-pics as "dont-know"

Could anyone else test the patch of Arnd?
Comment 9 Arnd Baecker 2007-09-08 15:34:21 UTC
- you could always install to a separate place without interfering
  with any other installation (see http://www.digikam.org/?q=download)
- I don't think it is a good idea to differentiate between  
  never rated and 0-rated. There is no visual difference between
  them and therefore no feed-back. Also sometimes you associate (accidentally)
  1-star just to realize there is another even better variant
  of that shot, so the 1-star is changed to 0-star.
  Is that one better than never rated?
Comment 10 Warren Werner 2007-10-19 11:03:41 UTC
Arndt, 
I dont feel up to compiling it, sorry. 
I think you are right about the 0-rated and never-rated. 

Is ist going to be patched for the next version?
Comment 11 Marcel Wiesweg 2007-10-19 18:03:27 UTC
With the 0.9 db schema the rating has no real place, so this problem arises. In 0.10 the situation will be different: There will of course be a rating field for every image, currently initialized with 0.
(this introduces a question: Shall this be like this, or shall an image without rating have a rating of -1?)
Comment 12 Arnd Baecker 2007-10-19 18:10:08 UTC
I think there will be no visual difference for the user between -1 and 0,
so I would suggest 0 as default.

Do you think the patch is ok to be committed?
(And: as you wrote, it need not be backported to KDE4, right?)
Comment 13 Warren Werner 2007-10-19 19:05:56 UTC
Other possibility: 
If the picture is not voted, the stars are light grey. 
If the picture is voted (f.e. 3 stars) then three stars are yellow and two are light blue (f.e.). 
So if it is 0-rated, all stars are light blue and you see the difference. 

If we did so, we had also to add the option "unvote" to remove the vote. 
Comment 14 Arnd Baecker 2007-10-19 19:21:13 UTC
Essentially this means to introduce -1 as another rating level to 
the existing 0, 1, 2, 3, 4, 5. While the last suggestion
is a good proposal, I am not sure whether it is worth the coding effort ... ;-)

For the moment, I would suggest to treat never rated images the
same way as 0-rated (as the patch does), to fix an important bug.

Anything beyond this is surely an option which can
be discussed, in particular in the context of digikam >=0.10 (i.e KDE4).
Comment 15 Arnd Baecker 2007-10-30 19:21:28 UTC
SVN commit 731108 by abaecker:

Treat non-voted pictures as if they have 0-rating when doing a search.

CCBUGS: 147426
TODO:KDE4PORT



 M  +3 -2      NEWS  
 M  +15 -2     kioslave/digikamsearch.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=731108
Comment 16 Arnd Baecker 2007-10-30 19:23:26 UTC
For the port to KDE4:
The logic to be considered for 0.10  are the cases:

a) For val = 0:
   i)   >= 0  corresponds to search for >=-1
        I.e, choose:  val = -1, op = GTE
   ii)  == 0  corresponds to search for ==0 or == -1
        I.e, choose: val = 0, op = LTE
   iii) <= 0  corresponds to search for ==0 or == -1
        i.E. choose val = 0, op = LTE
b) For val >0:
   <  val
   <= val
   != val
So case b) does not need any special treatment anymore
as -1 < 0 ;-).
Comment 17 Arnd Baecker 2007-11-27 08:30:05 UTC
Marcel, Gilles: if for the KDE4 branch the default rating value is 0,
is it correct that nothing has to be changed and this bug can be closed?
Comment 18 caulier.gilles 2007-11-27 08:34:13 UTC
Arnd,

Warning: This is the only B.K.O file witch is not yet ported to KDE4. kioslave/digikamsearch.cpp need to be rewritten as well. 

Marcel, i suppose than you have planned to do it... Right ?

Gilles
Comment 19 Marcel Wiesweg 2008-04-21 21:33:39 UTC
The KDE4 version has an explicit way of searching for non-rated pictures. For one, all pictures have an assigned rating value (-1 initially, which means not assigned). In the advanced search window, in the rating search widget, you can select "No Rating Assigned". I plan to add "No rating assigned or Rating 0" as well.