[libdazzle] fuzzy: tweak scoring with penalties differently



commit ad4def03bfe551f5aa323f68114e1ef7175b8bea
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jun 4 21:25:18 2017 -0700

    fuzzy: tweak scoring with penalties differently
    
    This ensures the ordering using the penalty level.

 src/fuzzy/dzl-fuzzy-index-cursor.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/fuzzy/dzl-fuzzy-index-cursor.c b/src/fuzzy/dzl-fuzzy-index-cursor.c
index 2219e6b..3d5852f 100644
--- a/src/fuzzy/dzl-fuzzy-index-cursor.c
+++ b/src/fuzzy/dzl-fuzzy-index-cursor.c
@@ -431,7 +431,7 @@ dzl_fuzzy_index_cursor_worker (GTask        *task,
                                                         &match.priority))
                 continue;
 
-              match.score = 1.0 / (strlen (match.key) + item->position) * penalty;
+              match.score = penalty + ((1.0 / 255.0) * (1.0 / (strlen (match.key) + item->position)));
 
               g_array_append_val (self->matches, match);
             }
@@ -463,6 +463,7 @@ dzl_fuzzy_index_cursor_worker (GTask        *task,
                                                 &match.priority))
         continue;
 
+      match.score = penalty + ((1.0 / 255.0) * (1.0 / (strlen (match.key) + score)));
 
       if (g_hash_table_lookup_extended (by_document,
                                         GUINT_TO_POINTER (match.document_id),


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