]> mj.ucw.cz Git - libucw.git/blobdiff - lib/custom.h
Added secondary sorting (i.e., breaking ties when two documents have the same Q)
[libucw.git] / lib / custom.h
index 2244dd848a5c532cfc4b6429752472a7db086fac..250a7bac19afc6636efac7ce32aff61cfc26e050 100644 (file)
@@ -1,19 +1,13 @@
 /*
  *     Sherlock: Custom Parts of Configuration
  *
- *     (c) 2001 Martin Mares <mj@ucw.cz>
+ *     (c) 2001--2002 Martin Mares <mj@ucw.cz>
  */
 
 /* Name of this customization (version suffix) */
 
 #define SHER_SUFFIX ""
 
-/* Features */
-
-#define  SHERLOCK_CONFIG_LARGE_DB      /* Support for DB files >4GB */
-#define  SHERLOCK_CONFIG_LFS           /* Large files on 32-bit systems */
-#define  SHERLOCK_CONFIG_LFS_LIBC      /* LFS supported directly by libc */
-
 /* Word types */
 
 enum word_type {
@@ -84,3 +78,43 @@ enum string_type {
 #define STRING_TYPES_URL ((1 << ST_URL) | (1 << ST_REF) | (1 << ST_BACKREF))
 /* These must be indexed in lowercase form */
 #define STRING_TYPES_CASE_INSENSITIVE ((1 << ST_HOST) | (1 << ST_DOMAIN))
+
+/*
+ *  Definitions of custom attributes:
+ *
+ *  INT_ATTR(type, id, oattr, keyword, get_func, parse_func)
+ *
+ *  type       data type used to hold the value
+ *  id         C identifier of the attribute
+ *  oattr      object attribute we get the value from
+ *  keywd      search server keyword for the attribute
+ *  void get_func(struct card_attr *ca, byte *attr)
+ *             parse object attribute (may be NULL)
+ *  byte *parse_func(u32 *dest, byte *value, uns intval)
+ *             parse value in query (returns error message or NULL)
+ *             for KEYWD = "string", it gets value="string", intval=0
+ *             for KEYWD = num, it gets value=NULL, intval=num.
+ *
+ *  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 */
+
+#define CUSTOM_ATTRS INT_ATTR(u32, lm, 'L', LM, custom_get_lm, custom_parse_lm)
+
+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
+
+#endif