2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.20 1995-11-27 13:58:53 adam
8 * New option -t. storeStore data implemented in server.
10 * Revision 1.19 1995/11/25 10:24:06 adam
11 * More record fields - they are enumerated now.
12 * New options: flagStoreData flagStoreKey.
14 * Revision 1.18 1995/11/22 17:19:17 adam
15 * Record management uses the bfile system.
17 * Revision 1.17 1995/11/21 15:01:16 adam
18 * New general match criteria implemented.
19 * New feature: document groups.
21 * Revision 1.16 1995/11/20 11:56:27 adam
22 * Work on new traversal.
24 * Revision 1.15 1995/11/01 16:25:51 quinn
25 * *** empty log message ***
27 * Revision 1.14 1995/10/17 18:02:09 adam
28 * New feature: databases. Implemented as prefix to words in dictionary.
30 * Revision 1.13 1995/10/10 12:24:39 adam
31 * Temporary sort files are compressed.
33 * Revision 1.12 1995/10/04 16:57:20 adam
34 * Key input and merge sort in one pass.
36 * Revision 1.11 1995/09/29 14:01:45 adam
39 * Revision 1.10 1995/09/28 14:22:57 adam
40 * Sort uses smaller temporary files.
42 * Revision 1.9 1995/09/14 07:48:24 adam
43 * Record control management.
45 * Revision 1.8 1995/09/06 16:11:18 adam
46 * Option: only one word key per file.
48 * Revision 1.7 1995/09/05 15:28:39 adam
49 * More work on search engine.
51 * Revision 1.6 1995/09/04 12:33:43 adam
52 * Various cleanup. YAZ util used instead.
54 * Revision 1.5 1995/09/04 09:10:39 adam
55 * More work on index add/del/update.
56 * Merge sort implemented.
57 * Initial work on z39 server.
59 * Revision 1.4 1995/09/01 14:06:36 adam
60 * Split of work into more files.
62 * Revision 1.3 1995/09/01 10:57:07 adam
65 * Revision 1.2 1995/09/01 10:30:24 adam
66 * More work on indexing. Not working yet.
68 * Revision 1.1 1995/08/31 14:50:24 adam
69 * New simple file index tool.
81 size_t mem_max = 4*1024*1024;
82 extern char *data1_tabpath;
84 int main (int argc, char **argv)
89 char *configName = NULL;
91 int key_open_flag = 0;
93 struct recordGroup rGroup;
95 rGroup.groupName = NULL;
96 rGroup.databaseName = NULL;
98 rGroup.fileMatch = NULL;
99 rGroup.flagStoreData = -1;
100 rGroup.flagStoreKeys = -1;
101 rGroup.fileType = NULL;
106 fprintf (stderr, "index [-v log] [-m meg] [-c config] [-d base]"
107 " [-g group] cmd1 dir1 cmd2 dir2 ...\n");
110 while ((ret = options ("t:c:g:v:m:d:", argv, argc, &arg)) != -2)
114 if(cmd == 0) /* command */
116 if (!strcmp (arg, "add"))
120 else if (!strcmp (arg, "del"))
124 else if (!strcmp (arg, "update"))
130 logf (LOG_FATAL, "Unknown command: %s", arg);
136 if (!common_resource)
138 common_resource = res_open (configName ?
139 configName : "base");
140 if (!common_resource)
142 logf (LOG_FATAL, "Cannot open resource `%s'",
146 data1_tabpath = res_get (common_resource, "data1_tabpath");
147 assert (data1_tabpath);
156 repositoryUpdate (&rGroup);
158 repositoryAdd (&rGroup);
160 repositoryDelete (&rGroup);
166 log_init (log_mask_str(arg), prog, NULL);
170 mem_max = 1024*1024*atoi(arg);
174 rGroup.databaseName = arg;
178 rGroup.groupName = arg;
183 rGroup.fileType = arg;
186 logf (LOG_FATAL, "Unknown option '-%s'", arg);
192 nsections = key_close ();
195 logf (LOG_LOG, "Input");
196 key_input (FNAME_WORD_DICT, FNAME_WORD_ISAM, nsections, 60);