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