[Digikam-devel] [Bug 141037] Search using Tag Name does not work

Arnd Baecker arnd.baecker at web.de
Fri Sep 7 17:19:12 BST 2007


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=141037         
arnd.baecker web de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
      everconfirmed|0                           |1



------- Additional Comments From arnd.baecker web de  2007-09-07 18:19 -------
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?



More information about the Digikam-devel mailing list