[devhelp/aleksander/book-filters-update: 3/7] keyword-model: always prefer exact link in the current book
- From: Aleksander Morgado <aleksm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/aleksander/book-filters-update: 3/7] keyword-model: always prefer exact link in the current book
- Date: Mon, 30 Sep 2013 11:50:02 +0000 (UTC)
commit a943f3c006d82d762cde5989a971e769763ff2d7
Author: Aleksander Morgado <aleksander lanedo com>
Date: Sun Sep 29 17:17:26 2013 +0200
keyword-model: always prefer exact link in the current book
src/dh-keyword-model.c | 14 ++++++++++++--
1 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/dh-keyword-model.c b/src/dh-keyword-model.c
index e232a34..8ad7401 100644
--- a/src/dh-keyword-model.c
+++ b/src/dh-keyword-model.c
@@ -628,6 +628,8 @@ keyword_model_search (DhKeywordModel *model,
GList *in_book_non_prefixed = NULL;
GList *other_books_prefixed = NULL;
GList *other_books_non_prefixed = NULL;
+ DhLink *in_book_exact_link = NULL;
+ DhLink *other_books_exact_link = NULL;
/* If book_id given; first look for items in the given book id */
if (book_id) {
@@ -643,7 +645,7 @@ keyword_model_search (DhKeywordModel *model,
TRUE,
n_hits_left,
&n_hits,
- exact_link);
+ &in_book_exact_link);
n_hits_left -= n_hits;
/* If not enough hits, get non-prefixed ones */
@@ -679,7 +681,7 @@ keyword_model_search (DhKeywordModel *model,
TRUE,
n_hits_left,
&n_hits,
- exact_link);
+ &other_books_exact_link);
n_hits_left -= n_hits;
/* If not enough hits, get non-prefixed ones */
@@ -698,6 +700,14 @@ keyword_model_search (DhKeywordModel *model,
}
}
+ /* Prefer in-book exact link */
+ if (in_book_exact_link)
+ *exact_link = in_book_exact_link;
+ else if (other_books_exact_link)
+ *exact_link = other_books_exact_link;
+ else
+ *exact_link = NULL;
+
/* Build resulting list */
return (g_list_concat (
g_list_concat (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]