2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.18 1995-11-22 17:19:17 adam
8 * Record management uses the bfile system.
10 * Revision 1.17 1995/11/21 15:01:16 adam
11 * New general match criteria implemented.
12 * New feature: document groups.
14 * Revision 1.16 1995/11/20 11:56:27 adam
15 * Work on new traversal.
17 * Revision 1.15 1995/11/01 16:25:51 quinn
18 * *** empty log message ***
20 * Revision 1.14 1995/10/17 18:02:09 adam
21 * New feature: databases. Implemented as prefix to words in dictionary.
23 * Revision 1.13 1995/10/10 12:24:39 adam
24 * Temporary sort files are compressed.
26 * Revision 1.12 1995/10/04 16:57:20 adam
27 * Key input and merge sort in one pass.
29 * Revision 1.11 1995/09/29 14:01:45 adam
32 * Revision 1.10 1995/09/28 14:22:57 adam
33 * Sort uses smaller temporary files.
35 * Revision 1.9 1995/09/14 07:48:24 adam
36 * Record control management.
38 * Revision 1.8 1995/09/06 16:11:18 adam
39 * Option: only one word key per file.
41 * Revision 1.7 1995/09/05 15:28:39 adam
42 * More work on search engine.
44 * Revision 1.6 1995/09/04 12:33:43 adam
45 * Various cleanup. YAZ util used instead.
47 * Revision 1.5 1995/09/04 09:10:39 adam
48 * More work on index add/del/update.
49 * Merge sort implemented.
50 * Initial work on z39 server.
52 * Revision 1.4 1995/09/01 14:06:36 adam
53 * Split of work into more files.
55 * Revision 1.3 1995/09/01 10:57:07 adam
58 * Revision 1.2 1995/09/01 10:30:24 adam
59 * More work on indexing. Not working yet.
61 * Revision 1.1 1995/08/31 14:50:24 adam
62 * New simple file index tool.
74 size_t mem_max = 4*1024*1024;
75 extern char *data1_tabpath;
77 int main (int argc, char **argv)
82 char *configName = NULL;
84 int key_open_flag = 0;
86 struct recordGroup rGroup;
88 rGroup.groupName = NULL;
89 rGroup.databaseName = NULL;
95 fprintf (stderr, "index [-v log] [-m meg] [-c config] [-d base]"
96 " [-g group] cmd1 dir1 cmd2 dir2 ...\n");
99 while ((ret = options ("c:g:v:m:d:", argv, argc, &arg)) != -2)
103 if(cmd == 0) /* command */
105 if (!strcmp (arg, "add"))
109 else if (!strcmp (arg, "del"))
113 else if (!strcmp (arg, "update"))
119 logf (LOG_FATAL, "Unknown command: %s", arg);
125 if (!common_resource)
127 common_resource = res_open (configName ?
128 configName : "base");
129 if (!common_resource)
131 logf (LOG_FATAL, "Cannot open resource `%s'",
135 data1_tabpath = res_get (common_resource, "data1_tabpath");
136 assert (data1_tabpath);
145 repositoryUpdate (&rGroup);
147 repositoryAdd (&rGroup);
149 repositoryDelete (&rGroup);
155 log_init (log_mask_str(arg), prog, NULL);
159 mem_max = 1024*1024*atoi(arg);
163 rGroup.databaseName = arg;
167 rGroup.groupName = arg;
173 logf (LOG_FATAL, "Unknown option '-%s'", arg);
179 nsections = key_close ();
182 logf (LOG_LOG, "Input");
183 key_input (FNAME_WORD_DICT, FNAME_WORD_ISAM, nsections, 60);