[shotwell/shotwell-0.24] More reliable duplicate detection



commit cdebd924aaee672c08fe74fff4192b060e5b500e
Author: Andreas Brauchli <andreas brauchli sensirion com>
Date:   Thu Dec 8 16:09:32 2016 +0100

    More reliable duplicate detection
    
    Never compare thumbnail_md5 when the full md5 can be used to avoid false
    positive. Otherwise fall back to comparing thubnail_md5 where false
    positives are possible.

 src/db/PhotoTable.vala |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/db/PhotoTable.vala b/src/db/PhotoTable.vala
index 4304da8..24cec86 100644
--- a/src/db/PhotoTable.vala
+++ b/src/db/PhotoTable.vala
@@ -920,14 +920,15 @@ public class PhotoTable : DatabaseTable {
                 sql += " OR ((";
             first = false;
             
-            if (thumbnail_md5 != null)
-                sql += " thumbnail_md5=?";
-            
             if (md5 != null) {
-                if (thumbnail_md5 == null)
-                    sql += " md5=?";
+                sql += " md5=?";
+
+            }
+            if (thumbnail_md5 != null) {
+                if (md5 == null)
+                    sql += " thumbnail_md5=?";
                 else
-                    sql += " OR md5=?";
+                    sql += " OR (md5 IS NULL AND thumbnail_md5=?)";
             }
             
             sql += ")";


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]