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