[libdazzle] fuzzy: score 1 character searches



commit 7ab622a6b1f7ba20b4c9bfa566389db8c06e84ba
Author: Christian Hergert <chergert redhat com>
Date:   Sat Jun 3 20:03:32 2017 -0700

    fuzzy: score 1 character searches
    
    Before these were all 0, try to at least do something better than that
    here using the offset of the first match character.

 src/fuzzy/dzl-fuzzy-mutable-index.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/fuzzy/dzl-fuzzy-mutable-index.c b/src/fuzzy/dzl-fuzzy-mutable-index.c
index b6c6a2f..a651acd 100644
--- a/src/fuzzy/dzl-fuzzy-mutable-index.c
+++ b/src/fuzzy/dzl-fuzzy-mutable-index.c
@@ -478,7 +478,7 @@ dzl_fuzzy_mutable_index_match (DzlFuzzyMutableIndex *fuzzy,
             {
               match.key = dzl_fuzzy_mutable_index_get_string (fuzzy, item->id);
               match.value = g_ptr_array_index (fuzzy->id_to_value, item->id);
-              match.score = 0;
+              match.score = 1.0 / (strlen (match.key) + item->pos);
               g_array_append_val (matches, match);
               last_id = match.id;
             }


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