Summary: | Search using Tag Name does not work | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Geoff King <gsking1> |
Component: | Searches-Advanced | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | caulier.gilles |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 0.9.4 | |
Sentry Crash Report: |
Description
Geoff King
2007-02-02 01:18:11 UTC
This 'Does Not Contain' search fails when the image has multiple tags. When the 'Does Not Contain' search is done on an image with ONE tag, it works. Ex. Search for (Tag Does Not Contain "Dog") and the file only has "Dog" tag, it is not displayed. When the same search (Tag Does Not Contain 'Dog') is done on an image with two or more tags such as "Dog" and "Max", the image is displayed and it should not be. Hope this helps. Thanks for the good analysis, in particular #1 is helpful because it appears so puzzling at first ;-): I have set up a test for this with 3 images in an Album named `DoesNotContain` with tags association Image1.jpg Tag1 TagBoth Image2.jpg Tag2 TagBoth Image3.jpg TagBoth For a search, "Album Name" "Contains" DoesNotContain" as well as "Tag Name" "Does Not Contain" "TagBoth Image1 and Image2 appear, but no image should be shown The query send to the sql database is: 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 '%DoesNotContain%')) AND (Images.id IN (SELECT imageid FROM ImageTags WHERE tagid IN (SELECT id FROM Tags WHERE name NOT LIKE '%TagBoth%'))) ) AND (Albums.id=Images.dirid); Let my try to analyze this (with my limited sql understand ...): the expression in () after the first AND gets all the ids of tags whose name is not like a given string. Then it gets all imageid's to which any of these tags is associated. Clearly this means that all images which have a different tag are also included. OK, that was the easy part. The logic puzzle is now to construct a better query. First attempt: (Images.id IN (SELECT imageid FROM ImageTags WHERE tagid NOT IN (SELECT id FROM Tags WHERE name LIKE '%TagBoth%'))) This should get the tag id's of all tags which are similar to "TagBooth". Then it should select all imageids for which ImageTags are not in that list of all tags. Hmm, not sure if this will work. Marcel? ... ;-) BTW: could other searches be affected from the underlying problem as well? Look at this: For the key "TAG", in subQuery() there are four cases handled distinctly. I assume the same should be done with "TAGNAME" as well. SVN commit 777086 by mwiesweg: Backport SQL from 0.10 branch, now it is in analogy to the "TAG" search field above. I think this fixes 141037. CCBUG: 141037 M +24 -4 digikamsearch.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=777086 Great: I just checked the example in c#2 and now it works as expected. Seems to be fixed. Thanks. Geoff, thanks a lot for the feedback (and again for the good analysis at the beginning!). Best, Arnd |