Bug 120479

Summary: Search problem for not tagged or commented images.
Product: [Applications] digikam Reporter: Werner (flixor) <werner>
Component: Searches-AdvancedAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0

Description Werner (flixor) 2006-01-19 20:33:18 UTC
Version:           digikam 0.81 (using KDE KDE 3.5.0)
Installed from:    Ubuntu Packages
OS:                Linux

An image wich is not tagged or have any comments wont display in the search result. Which means, if you search for the image name, it wont be displayed.
Comment 1 Maxime Delorme 2006-01-23 23:06:19 UTC
I confirm but the bug is not really as describe
If the table ImageProperties is empty nothing is found....
I think a left join should be better.
For example I put a rating on a picture then the ImageProperties get one entry, and the I can find it for digikam 0.8.1 on kubuntu kde 3.5
Comment 2 Wennael Lemonnier 2006-01-24 22:22:46 UTC
I have reproduced this bug, using digiKam 0.8.1. I have triend to search with a keyword present in most names of my images ('2006' because I have some photos that are named 2006*.jpg) and the search won't find any photos

After, I've added a comment 'test' to one photo, and search for this keyword in the search tool. The photo was instantly found !
Comment 3 Tom Albers 2006-02-03 22:03:35 UTC
SVN commit 505430 by toma:

I'm very sorry I made the search as good as useless in 0.8.1. I hope this fixes this issue (thanks for the hint Maxime).
Can anyone fonfirm that?
BUG: 120479,120775


 M  +4 -4      digikamsearch.cpp  


--- branches/stable/extragear/graphics/digikam/kioslave/digikamsearch.cpp #505429:505430
@@ -136,7 +136,7 @@
 
         // query head
         sqlQuery = "SELECT Images.id, Images.name, Images.dirid, Images.datetime, Albums.url "
-                   "FROM Images, Albums, ImageProperties "
+                   "FROM Images, Albums LEFT JOIN ImageProperties ON Images.id = Imageproperties.imageid "
                    "WHERE ( ";
 
         // query body
@@ -144,7 +144,7 @@
 
         // query tail
         sqlQuery += " ) ";
-        sqlQuery += " AND (Albums.id=Images.dirid) AND (Images.id = ImageProperties.imageid); ";
+        sqlQuery += " AND (Albums.id=Images.dirid); ";
 
         QStringList values;
         QString     errMsg;
@@ -240,7 +240,7 @@
 
         // query head
         sqlQuery = "SELECT Albums.url||'/'||Images.name "
-                   "FROM Images, Albums, ImageProperties "
+                   "FROM Images, Albums LEFT JOIN ImageProperties on Images.id = ImageProperties.imageid "
                    "WHERE ( ";
 
         // query body
@@ -248,7 +248,7 @@
 
         // query tail
         sqlQuery += " ) ";
-        sqlQuery += " AND (Albums.id=Images.dirid) AND (Images.id = ImageProperties.imageid) ";
+        sqlQuery += " AND (Albums.id=Images.dirid) ";
         sqlQuery += " LIMIT 500;";
 
         QStringList values;
Comment 4 Tom Albers 2006-02-03 22:12:26 UTC
SVN commit 505437 by toma:

forwardport SVN commit 505430 by toma: I'm very sorry I made the search as good as useless in 0.8.1. I hope this fixes this issue (thanks for the hint Maxime).
CCBUG: 120479,120775



 M  +4 -4      digikamsearch.cpp  


--- trunk/extragear/graphics/digikam/kioslave/digikamsearch.cpp #505436:505437
@@ -136,7 +136,7 @@
 
         // query head
         sqlQuery = "SELECT Images.id, Images.name, Images.dirid, Images.datetime, Albums.url "
-                   "FROM Images, Albums, ImageProperties "
+                   "FROM Images, Albums LEFT JOIN ImageProperties ON Images.id = Imageproperties.imageid "
                    "WHERE ( ";
 
         // query body
@@ -144,7 +144,7 @@
 
         // query tail
         sqlQuery += " ) ";
-        sqlQuery += " AND (Albums.id=Images.dirid) AND (Images.id = ImageProperties.imageid); ";
+        sqlQuery += " AND (Albums.id=Images.dirid); ";
 
         QStringList values;
         QString     errMsg;
@@ -240,7 +240,7 @@
 
         // query head
         sqlQuery = "SELECT Albums.url||'/'||Images.name "
-                   "FROM Images, Albums, ImageProperties "
+                   "FROM Images, Albums LEFT JOIN ImageProperties on Images.id = ImageProperties.imageid "
                    "WHERE ( ";
 
         // query body
@@ -248,7 +248,7 @@
 
         // query tail
         sqlQuery += " ) ";
-        sqlQuery += " AND (Albums.id=Images.dirid) AND (Images.id = ImageProperties.imageid) ";
+        sqlQuery += " AND (Albums.id=Images.dirid) ";
         sqlQuery += " LIMIT 500;";
 
         QStringList values;
Comment 5 Tung NGUYEN 2006-02-04 16:15:40 UTC
Tom, 

I have tested your SVN commits : quick and advanced searches work fine now.

Thank you for the fix.

---
Tung.