Version: 0.8.2 (using KDE KDE 3.5.3) Installed from: Debian testing/unstable Packages When searching for pictures, it is possible to specify the tag the picture should have, so the search returns all pictures with this tag. However, it does not return any pictures with sub-tags of the specified tag. IMHO it would be useful to add operators "Contains" and "Does not contain" for tag searching that would take sub-tags into account. E.g. selecting "Tag contains People/Family" would return all pictures tagged with any subtag of People/Family.
Created attachment 17267 [details] Proposed patch to solve the feature request.
SVN commit 570853 by mwiesweg: Applying proposed patch. Thanks to Richard Kralovic. BUG: 132011 M +2 -0 digikam/searchwidgets.cpp M +15 -1 kioslave/digikamsearch.cpp --- trunk/extragear/graphics/digikam/digikam/searchwidgets.cpp #570852:570853 @@ -95,6 +95,8 @@ { I18N_NOOP("Does Not Equal"), "NE", SearchAdvancedRule::ALBUMS }, { I18N_NOOP("Equals"), "EQ", SearchAdvancedRule::TAGS }, { I18N_NOOP("Does Not Equal"), "NE", SearchAdvancedRule::TAGS }, + { I18N_NOOP("Contains"), "LIKE", SearchAdvancedRule::TAGS }, + { I18N_NOOP("Does Not Contain"), "NLIKE", SearchAdvancedRule::TAGS }, { I18N_NOOP("After"), "GT", SearchAdvancedRule::DATE }, { I18N_NOOP("Before"), "LT", SearchAdvancedRule::DATE }, { I18N_NOOP("Equals"), "EQ", SearchAdvancedRule::DATE }, --- trunk/extragear/graphics/digikam/kioslave/digikamsearch.cpp #570852:570853 @@ -471,14 +471,26 @@ query = " (Images.id IN " " (SELECT imageid FROM ImageTags " " WHERE tagid = $$@@$$)) "; - else + else if (op == NE) query = " (Images.id NOT IN " " (SELECT imageid FROM ImageTags " " WHERE tagid = $$@@$$)) "; + else if (op == LIKE) + query = " (Images.id IN " + " (SELECT ImageTags.imageid FROM ImageTags JOIN TagsTree on ImageTags.tagid = TagsTree.id " + " WHERE TagsTree.pid = $$@@$$ or ImageTags.tagid = $$@@$$ )) "; + else // op == NLIKE + query = " (Images.id NOT IN " + " (SELECT ImageTags.imageid FROM ImageTags JOIN TagsTree on ImageTags.tagid = TagsTree.id " + " WHERE TagsTree.pid = $$@@$$ or ImageTags.tagid = $$@@$$ )) "; // query = " (Images.id IN " // " (SELECT imageid FROM ImageTags " // " WHERE tagid $$##$$ $$@@$$)) "; + + query.replace("$$@@$$", QString::fromLatin1("'") + escapeString(val) + + QString::fromLatin1("'")); + break; } case(TAGNAME): @@ -516,6 +528,7 @@ } } + if (key != TAG) { switch (op) { case(EQ): @@ -561,6 +574,7 @@ break; } } + } // special case for imagedate. If the key is imagedate and the operator is EQ, // we need to split it into two rules