From 157acec25f2e60c76607edc3d62cf23fe47f4efe Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 20 Apr 2002 15:09:41 +0000 Subject: [PATCH] Added secondary sorting (i.e., breaking ties when two documents have the same Q) on any of the custom attributes. Just define CUSTOM_SORTING in lib/custom.h. I've also removed secondary sorting of result heap by site ID inside refs.c -- according to my best knowledge it wasn't required anywhere. Maybe we can remove the CUSTOM_SORTING switch and just leave the sec_sort_key in struct result_note initialized to zero, but it would cost us 4 bytes per result_note which I wanted to avoid. --- lib/custom.h | 5 +++++ lib/index.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/custom.h b/lib/custom.h index f4a57115..250a7bac 100644 --- a/lib/custom.h +++ b/lib/custom.h @@ -98,6 +98,9 @@ enum string_type { * A good place for definitions of the functions is lib/custom.c. * * Please order the attributes by decreasing size to get optimum padding. + * + * If you also want the search server to sort by a custom attribute + * on ties, define CUSTOM_SORTING. */ #if 0 /* Example */ @@ -108,6 +111,8 @@ struct card_attr; void custom_get_lm(struct card_attr *ca, byte *attr); byte *custom_parse_lm(u32 *dest, byte *value, uns intval); +#define CUSTOM_SORTING + #else #define CUSTOM_ATTRS diff --git a/lib/index.h b/lib/index.h index dc8dab1a..6a22cf17 100644 --- a/lib/index.h +++ b/lib/index.h @@ -1,7 +1,7 @@ /* * Sherlock: Data structures used in indices * - * (c) 2001 Martin Mares + * (c) 2001--2002 Martin Mares */ /* Words */ -- 2.39.2