]> mj.ucw.cz Git - libucw.git/commitdiff
More configuration enhancements:
authorMartin Mares <mj@ucw.cz>
Wed, 22 Jan 2003 11:23:19 +0000 (11:23 +0000)
committerMartin Mares <mj@ucw.cz>
Wed, 22 Jan 2003 11:23:19 +0000 (11:23 +0000)
o  gatherer, indexer and search server can be left out, which can be useful
   when using Sherlock for indexing databases, because unusual custom.h
   with standard word types missing makes many gatherer modules uncompilable.
o  searching by document age is optional, you can switch it off to save
   index space.
o  indexing of file types is now partially supported by the default configuration,
   because I'm going to use the bottom 5 bits of the file_type (which were
   used only for images) for storing language code of text documents and
   it certainly isn't a centrum-specific thing. On the other hand, I'd like
   to keep the exact meaning of file type codes application specific, so the
   actual matching of file types is left in the customization header. Again,
   you can switch this off to save index space.

lib/index.h

index b17e9a62626440c342d1632086ffa94aa8bc7e1b..0fb8a147bba9b1b091e8311cb82f793f08bdb8fd 100644 (file)
@@ -46,8 +46,12 @@ struct card_attr {
   CUSTOM_CARD_ATTRS                    /* Include all custom attributes */
   byte weight;
   byte flags;
+#ifdef CONFIG_LASTMOD
   byte age;                            /* Document age in pseudo-logarithmic units wrt. reference time */
-  // byte rfu[1];                      /* If no custom attributes are defined */
+#endif
+#ifdef CONFIG_FILETYPE
+  byte type_flags;                     /* File type flags (see below) */
+#endif
 };
 
 enum card_flag {
@@ -60,6 +64,19 @@ enum card_flag {
 
 #define CARD_POS_SHIFT 5               /* Card positions are shifted this # of bytes to the right */
 
+/*
+ *  We store document type and several other properties in card_attr->type_flags.
+ *  Here we define only the basic structure, the details and also how to match the
+ *  types are defined in custom.h.
+ *
+ *  bits 7--5  file type: (0-3: text types, 4-7: other types, defined by custom.h)
+ *  bits 4--0  type-dependent information, for text types it's document language code
+ */
+
+#define CA_GET_FILE_TYPE(a) ((a)->type_flags >> 5)
+#define CA_GET_FILE_INFO(a) ((a)->type_flags & 0x1f)
+#define CA_GET_FILE_LANG(a) ((a)->type_flags & 0x80 ? 0 : CA_GET_FILE_INFO(a))
+
 /* String fingerprints */
 
 struct fingerprint {