From: Martin Mares Date: Wed, 22 Jan 2003 11:23:19 +0000 (+0000) Subject: More configuration enhancements: X-Git-Tag: holmes-import~1302 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=f91be42d158f7663d636169d8a09d986c1595a67;p=libucw.git More configuration enhancements: 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. --- diff --git a/lib/index.h b/lib/index.h index b17e9a62..0fb8a147 100644 --- a/lib/index.h +++ b/lib/index.h @@ -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 {