New result set model and modular ranking system. Moved towards
[idzebra-moved-to-github.git] / index / recindxp.h
1 /*
2  * Copyright (C) 1994-1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: recindxp.h,v $
7  * Revision 1.4  1998-03-05 08:45:12  adam
8  * New result set model and modular ranking system. Moved towards
9  * descent server API. System information stored as "SGML" records.
10  *
11  * Revision 1.3  1995/12/11 11:45:55  adam
12  * Removed commented code.
13  *
14  * Revision 1.2  1995/12/11  09:12:51  adam
15  * The rec_get function returns NULL if record doesn't exist - will
16  * happen in the server if the result set records have been deleted since
17  * the creation of the set (i.e. the search).
18  * The server saves a result temporarily if it is 'volatile', i.e. the
19  * set is register dependent.
20  *
21  * Revision 1.1  1995/12/06  12:41:25  adam
22  * New command 'stat' for the index program.
23  * Filenames can be read from stdin by specifying '-'.
24  * Bug fix/enhancement of the transformation from terms to regular
25  * expressons in the search engine.
26  *
27  */
28
29 #include "recindex.h"
30
31 #include <bfile.h>
32
33 #define REC_BLOCK_TYPES 2
34 #define REC_HEAD_MAGIC "recindx"
35
36 struct records_info {
37     int rw;
38
39     char *index_fname;
40     BFile index_BFile;
41
42     char *data_fname[REC_BLOCK_TYPES];
43     BFile data_BFile[REC_BLOCK_TYPES];
44
45     char *tmp_buf;
46     int tmp_size;
47
48     struct record_cache_entry *record_cache;
49     int cache_size;
50     int cache_cur;
51     int cache_max;
52
53     struct records_head {
54         char magic[8];
55         int block_size[REC_BLOCK_TYPES];
56         int block_free[REC_BLOCK_TYPES];
57         int block_last[REC_BLOCK_TYPES];
58         int block_used[REC_BLOCK_TYPES];
59         int block_move[REC_BLOCK_TYPES];
60
61         int total_bytes;
62         int index_last;
63         int index_free;
64         int no_records;
65
66     } head;
67 };
68
69 enum recordCacheFlag { recordFlagNop, recordFlagWrite, recordFlagNew,
70                        recordFlagDelete };
71
72 struct record_cache_entry {
73     Record rec;
74     enum recordCacheFlag flag;
75 };
76
77 struct record_index_entry {
78     int next;         /* first block of record info / next free entry */
79     int size;         /* size of record or 0 if free entry */
80 };
81