Version: 1.9.0 (using KDE 4.6.2) OS: Linux I click on tags on the left side and choose a specific tag. This tag (database id 292) is set on ~13000 pictures. But the search displays several images with another tag (database id 41). I looked up the pictures in the mysql database and I can confirm that there is no tag id 292 on those pictures the search result for id 41 gives back. After some investigation there is something wrong with all tag searches. Reproducible: Always Steps to Reproduce: Choose a tag from the tag search. Actual Results: Wrong images. Expected Results: Right images. Couldn't find that it's already fixed.
You double checked that 41 is not a child of 292 and "include tag subtree" is checked?
Yes, I haven't checked "include tag subtree" and it's not a child of 292. They are both in different groups. This actually happens quite often not just with one tag-id.
I am testing with 2.0 and SQlite, so chances are I cannot reproduce this. The relevant SQL is SELECT DISTINCT Images.id, Images.name, Images.album, Albums.albumRoot, ImageInformation.rating, Images.category, ImageInformation.format, ImageInformation.creationDate, Images.modificationDate, Images.fileSize, ImageInformation.width, ImageInformation.height FROM Images INNER JOIN ImageInformation ON Images.id=ImageInformation.imageid INNER JOIN Albums ON Albums.id=Images.album WHERE Images.status=1 AND Images.id IN (SELECT imageid FROM ImageTags WHERE tagid=:tagID ); so the relevant subquery is SELECT imageid FROM ImageTags WHERE tagid=:tagID which is simple enough.
SELECT imageid FROM ImageTags WHERE tagid='292' gives the right images back. Digikam remains buggy.
confirmed; in mysql it is: SELECT DISTINCT Images.id, Images.name, Images.album, Albums.albumRoot, ImageInformation.rating, Images.category, ImageInformation.format, ImageInformation.creationDate, Images.modificationDate, Images.fileSize, ImageInformation.width, ImageInformation.height FROM Images INNER JOIN ImageInformation ON Images.id=ImageInformation.imageid INNER JOIN Albums ON Albums.id=Images.album WHERE Images.status=1 AND Images.id IN ( SELECT imageid FROM ImageTags WHERE tagid=? OR tagid IN (SELECT id FROM Tags WHERE lft BETWEEN (SELECT lft FROM Tags WHERE id=?) AND (SELECT rgt FROM Tags WHERE id=?)) ) need to review the thing (tomorrow?)
Francesco: According to the description, the bug also appears with the non-recursive tag listing (not "Include tags subtree") which should employ the much simpler version above. So we should double check that it indeed occurs with the non-recursive mode, and that also the simpler SQL is called by the ioslave (debug output from ioslave is easy to get, into ~/.xsession-errors), and see why this call breaks.
Because of localisation I got confused with "include tag-subtree" and "include album tag-subtree". I had "include tag-subtree" checked and when I discheck it, I get the right results. Anyway, there are no subtree's to the tags but it still messes up all the search results... It should give the same results since there are no subtags involved...
Ok, then it is most probably a problem with the TagsTree handling under MySQL, and under SQLite I will never see any problem.
(In reply to Frank Hommes from comment #0) > Version: 1.9.0 (using KDE 4.6.2) > OS: Linux > > I click on tags on the left side and choose a specific tag. This tag > (database id 292) is set on ~13000 pictures. > But the search displays several images with another tag (database id 41). > > I looked up the pictures in the mysql database and I can confirm that there > is no tag id 292 on those pictures the search result for id 41 gives back. > > After some investigation there is something wrong with all tag searches. > > Reproducible: Always > > Steps to Reproduce: > Choose a tag from the tag search. Do your mean searching by tags from left sidebar->advanced search from search tab ? > > Actual Results: > Wrong images. > > Expected Results: > Right images. > > Couldn't find that it's already fixed. I think it gives the correct results according to the tags. You need to make sure that the parent tag is not selected while searching for a specific image using tags.
(I use digikam 5.0.0-beta6) Steps to reproduce: Added several images and assigned tags to all of them. I used several tags which are common for multiple images. From the left sidebar, use Advanced Search from the Search tab. Use search by "tags". Actual results: On searching by 1 or 2 or multiple tags, all the required images are retrieved. If parent tag is not selected, only the images containing that specific tag are retrieved. Else, images with both child and parent tags are retrieved. Expected results: Same as actual results.