[gnome-builder/wip/plugins] fuzzy: if no max item is set, don't sort/filter results
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/plugins] fuzzy: if no max item is set, don't sort/filter results
- Date: Sat, 13 Jun 2015 03:46:11 +0000 (UTC)
commit 7e2c7cbe262834448c24a3470884ab07807483e2
Author: Christian Hergert <christian hergert me>
Date: Fri Jun 12 20:40:50 2015 -0700
fuzzy: if no max item is set, don't sort/filter results
This allows avoiding a sort when we will go through the search reducer
in a later phase.
contrib/search/fuzzy.c | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/contrib/search/fuzzy.c b/contrib/search/fuzzy.c
index c805668..6401556 100644
--- a/contrib/search/fuzzy.c
+++ b/contrib/search/fuzzy.c
@@ -477,15 +477,18 @@ fuzzy_match (Fuzzy *fuzzy,
g_array_append_val (matches, match);
}
- g_array_sort (matches, fuzzy_match_compare);
-
/*
* TODO: We could be more clever here when inserting into the array
* only if it is a lower score than the end or < max items.
*/
- if (max_matches && (matches->len > max_matches))
- g_array_set_size (matches, max_matches);
+ if (max_matches != 0)
+ {
+ g_array_sort (matches, fuzzy_match_compare);
+
+ if (max_matches && (matches->len > max_matches))
+ g_array_set_size (matches, max_matches);
+ }
cleanup:
g_free (downcase);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]