2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.31 1995-12-06 12:41:22 adam
8 * New command 'stat' for the index program.
9 * Filenames can be read from stdin by specifying '-'.
10 * Bug fix/enhancement of the transformation from terms to regular
11 * expressons in the search engine.
13 * Revision 1.30 1995/12/05 11:25:02 adam
14 * Include of zebraver.h.
16 * Revision 1.29 1995/11/28 09:09:40 adam
17 * Zebra config renamed.
18 * Use setting 'recordId' to identify record now.
19 * Bug fix in recindex.c: rec_release_blocks was invokeded even
20 * though the blocks were already released.
21 * File traversal properly deletes records when needed.
23 * Revision 1.28 1995/11/27 13:58:53 adam
24 * New option -t. storeStore data implemented in server.
26 * Revision 1.27 1995/11/25 10:24:06 adam
27 * More record fields - they are enumerated now.
28 * New options: flagStoreData flagStoreKey.
30 * Revision 1.26 1995/11/22 17:19:17 adam
31 * Record management uses the bfile system.
33 * Revision 1.25 1995/11/21 15:29:12 adam
34 * Config file 'base' read by default by both indexer and server.
36 * Revision 1.24 1995/11/21 15:01:15 adam
37 * New general match criteria implemented.
38 * New feature: document groups.
40 * Revision 1.23 1995/11/20 16:59:45 adam
41 * New update method: the 'old' keys are saved for each records.
43 * Revision 1.22 1995/11/20 11:56:26 adam
44 * Work on new traversal.
46 * Revision 1.21 1995/11/16 15:34:55 adam
47 * Uses new record management system in both indexer and server.
49 * Revision 1.20 1995/11/15 14:46:18 adam
50 * Started work on better record management system.
52 * Revision 1.19 1995/10/27 14:00:11 adam
53 * Implemented detection of database availability.
55 * Revision 1.18 1995/10/17 18:02:08 adam
56 * New feature: databases. Implemented as prefix to words in dictionary.
58 * Revision 1.17 1995/10/13 16:01:49 adam
61 * Revision 1.16 1995/10/10 12:24:38 adam
62 * Temporary sort files are compressed.
64 * Revision 1.15 1995/10/04 16:57:19 adam
65 * Key input and merge sort in one pass.
67 * Revision 1.14 1995/09/29 14:01:40 adam
70 * Revision 1.13 1995/09/28 14:22:56 adam
71 * Sort uses smaller temporary files.
73 * Revision 1.12 1995/09/28 12:10:32 adam
74 * Bug fixes. Field prefix used in queries.
76 * Revision 1.11 1995/09/27 12:22:28 adam
77 * More work on extract in record control.
78 * Field name is not in isam keys but in prefix in dictionary words.
80 * Revision 1.10 1995/09/14 07:48:23 adam
81 * Record control management.
83 * Revision 1.9 1995/09/11 13:09:33 adam
84 * More work on relevance feedback.
86 * Revision 1.8 1995/09/08 14:52:27 adam
87 * Minor changes. Dictionary is lower case now.
89 * Revision 1.7 1995/09/06 16:11:16 adam
90 * Option: only one word key per file.
92 * Revision 1.6 1995/09/05 15:28:39 adam
93 * More work on search engine.
95 * Revision 1.5 1995/09/04 12:33:42 adam
96 * Various cleanup. YAZ util used instead.
98 * Revision 1.4 1995/09/04 09:10:35 adam
99 * More work on index add/del/update.
100 * Merge sort implemented.
101 * Initial work on z39 server.
103 * Revision 1.3 1995/09/01 14:06:35 adam
104 * Split of work into more files.
106 * Revision 1.2 1995/09/01 10:30:24 adam
107 * More work on indexing. Not working yet.
109 * Revision 1.1 1995/08/31 14:50:24 adam
110 * New simple file index tool.
114 #include <zebraver.h>
115 #include <alexutil.h>
119 #define IT_MAX_WORD 256
120 #define IT_KEY_HAVE_SEQNO 1
121 #define IT_KEY_HAVE_FIELD 0
128 enum dirsKind { dirs_dir, dirs_file };
154 struct dirs_info *dirs_open (Dict dict, const char *rep);
155 struct dirs_entry *dirs_read (struct dirs_info *p);
156 struct dirs_entry *dirs_last (struct dirs_info *p);
157 void dirs_mkdir (struct dirs_info *p, const char *src, int ctime);
158 void dirs_rmdir (struct dirs_info *p, const char *src);
159 void dirs_add (struct dirs_info *p, const char *src, int sysno, int ctime);
160 void dirs_del (struct dirs_info *p, const char *src);
161 void dirs_free (struct dirs_info **pp);
163 struct dir_entry *dir_open (const char *rep);
164 void dir_sort (struct dir_entry *e);
165 void dir_free (struct dir_entry **e_p);
167 void repositoryUpdate (struct recordGroup *rGroup);
168 void repositoryAdd (struct recordGroup *rGroup);
169 void repositoryDelete (struct recordGroup *rGroup);
171 void key_open (int mem);
172 int key_close (void);
173 void key_write (int cmd, struct it_key *k, const char *str);
174 int key_compare (const void *p1, const void *p2);
175 int key_qsort_compare (const void *p1, const void *p2);
176 void key_logdump (int mask, const void *p);
177 void key_input (const char *dict_fname, const char *isam_fname,
178 int nkeys, int cache);
179 int merge_sort (char **buf, int from, int to);
181 #define TEMP_FNAME "keys%d.tmp"
182 #define FNAME_WORD_DICT "worddict"
183 #define FNAME_WORD_ISAM "wordisam"
184 #define FNAME_CONFIG "zebra.cfg"
186 struct strtab *strtab_mk (void);
187 int strtab_src (struct strtab *t, const char *name, void ***infop);
188 void strtab_del (struct strtab *t,
189 void (*func)(const char *name, void *info, void *data),
191 int index_char_cvt (int c);
192 int index_word_prefix (char *string, int attset_ordinal,
193 int local_attribute, const char *databaseName);
195 int fileExtract (SYSNO *sysno, const char *fname,
196 const struct recordGroup *rGroup, int deleteFlag);
198 void rec_prstat (void);