2 * Sherlock Gatherer: Data structures used in indices
4 * (c) 2001 Martin Mares <mj@ucw.cz>
9 #define MAX_WORD_LEN 64
14 WT_RESERVED, /* Reserved word type */
15 WT_TEXT, /* Ordinary text */
16 WT_EMPH, /* Emphasized text */
17 WT_SMALL, /* Small font */
18 WT_TITLE, /* Document title */
19 WT_SMALL_HEADING, /* Heading */
20 WT_BIG_HEADING, /* Larger heading */
21 WT_KEYWORD, /* Explicitly marked keyword */
22 WT_META, /* Various meta-information */
23 WT_ALT /* Alternate texts for graphical elements */
28 T(TEXT, 1 << WT_TEXT) \
29 T(EMPH, 1 << WT_EMPH) \
30 T(SMALL, 1 << WT_SMALL) \
31 T(TITLE, 1 << WT_TITLE) \
32 T(HDR1, 1 << WT_SMALL_HEADING) \
33 T(HDR2, 1 << WT_BIG_HEADING) \
34 T(KEYWD, 1 << WT_KEYWORD) \
35 T(META, 1 << WT_META) \
37 #define WORD_TYPE_NAMES \
39 T(TEXT, 1 << WT_TEXT) \
40 T(EMPH, 1 << WT_EMPH) \
41 T(SMALL, 1 << WT_SMALL) \
42 T(TITLE, 1 << WT_TITLE) \
43 T(HDR, (1 << WT_SMALL_HEADING) | (1 << WT_BIG_HEADING)) \
44 T(HDR1, 1 << WT_SMALL_HEADING) \
45 T(HDR2, 1 << WT_BIG_HEADING) \
46 T(KEYWD, 1 << WT_KEYWORD) \
47 T(META, 1 << WT_META) \
53 ST_RESERVED, /* Reserved string type */
54 ST_URL, /* URL of the document */
55 ST_HOST, /* Host name */
56 ST_DOMAIN, /* Domain name */
57 ST_REF, /* URL reference */
58 ST_BACKREF, /* Back-reference (frame or redirect source) */
61 #define STRING_TYPE_NAMES \
63 T(HOST, 1 << ST_HOST) \
64 T(DOMAIN, 1 << ST_DOMAIN) \
66 T(BACKREF, 1 << ST_BACKREF)
68 #define STRING_TYPES_URL ((1 << ST_URL) | (1 << ST_REF) | (1 << ST_BACKREF))
69 /* These must be indexed in lowercase form */
70 #define STRING_TYPES_CASE_INSENSITIVE ((1 << ST_HOST) | (1 << ST_DOMAIN))
72 /* Index card attributes */
75 u32 card; /* Reference to card description (either oid or filepos) */
83 CARD_FLAG_EMPTY = 1, /* Empty document (redirect, robot file etc.) [scanner] */
84 CARD_FLAG_ACCENTED = 2, /* Document contains accented characters [scanner] */
85 CARD_FLAG_DUP = 4, /* Removed as a duplicate [merger] */
86 CARD_FLAG_MERGED = 8, /* Destination of a merge [merger] */
89 #define CARD_POS_SHIFT 5 /* Card positions are shifted this # of bytes to the right */
91 /* String fingerprints */
97 void fingerprint(byte *string, struct fingerprint *fp);
100 fp_hash(struct fingerprint *fp)
102 return (fp->hash[0] << 24) | (fp->hash[1] << 16) | (fp->hash[2] << 8) | fp->hash[3];
105 /* Reading of tagged text (Unicode values, tags mapped to 0x80000000 and higher) */
107 #define GET_TAGGED_CHAR(p,u) do { \
111 else if (u >= 0x80) \
120 else if (u >= 0xa0) \
122 ASSERT(*p >= 0x80 && *p <= 0xbf); \
123 u = 0x80010000 + ((u & 0x0f) << 6) + (*p++ & 0x3f); \