2 * Copyright (C) 1994-1995, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.22 1995-11-28 09:09:42 adam
8 * Zebra config renamed.
9 * Use setting 'recordId' to identify record now.
10 * Bug fix in recindex.c: rec_release_blocks was invokeded even
11 * though the blocks were already released.
12 * File traversal properly deletes records when needed.
14 * Revision 1.21 1995/11/27 14:27:39 adam
15 * Renamed 'update' command to 'dir'.
17 * Revision 1.20 1995/11/27 13:58:53 adam
18 * New option -t. storeStore data implemented in server.
20 * Revision 1.19 1995/11/25 10:24:06 adam
21 * More record fields - they are enumerated now.
22 * New options: flagStoreData flagStoreKey.
24 * Revision 1.18 1995/11/22 17:19:17 adam
25 * Record management uses the bfile system.
27 * Revision 1.17 1995/11/21 15:01:16 adam
28 * New general match criteria implemented.
29 * New feature: document groups.
31 * Revision 1.16 1995/11/20 11:56:27 adam
32 * Work on new traversal.
34 * Revision 1.15 1995/11/01 16:25:51 quinn
35 * *** empty log message ***
37 * Revision 1.14 1995/10/17 18:02:09 adam
38 * New feature: databases. Implemented as prefix to words in dictionary.
40 * Revision 1.13 1995/10/10 12:24:39 adam
41 * Temporary sort files are compressed.
43 * Revision 1.12 1995/10/04 16:57:20 adam
44 * Key input and merge sort in one pass.
46 * Revision 1.11 1995/09/29 14:01:45 adam
49 * Revision 1.10 1995/09/28 14:22:57 adam
50 * Sort uses smaller temporary files.
52 * Revision 1.9 1995/09/14 07:48:24 adam
53 * Record control management.
55 * Revision 1.8 1995/09/06 16:11:18 adam
56 * Option: only one word key per file.
58 * Revision 1.7 1995/09/05 15:28:39 adam
59 * More work on search engine.
61 * Revision 1.6 1995/09/04 12:33:43 adam
62 * Various cleanup. YAZ util used instead.
64 * Revision 1.5 1995/09/04 09:10:39 adam
65 * More work on index add/del/update.
66 * Merge sort implemented.
67 * Initial work on z39 server.
69 * Revision 1.4 1995/09/01 14:06:36 adam
70 * Split of work into more files.
72 * Revision 1.3 1995/09/01 10:57:07 adam
75 * Revision 1.2 1995/09/01 10:30:24 adam
76 * More work on indexing. Not working yet.
78 * Revision 1.1 1995/08/31 14:50:24 adam
79 * New simple file index tool.
91 size_t mem_max = 4*1024*1024;
92 extern char *data1_tabpath;
94 int main (int argc, char **argv)
99 char *configName = NULL;
101 int key_open_flag = 0;
103 struct recordGroup rGroupDef;
105 rGroupDef.groupName = NULL;
106 rGroupDef.databaseName = NULL;
107 rGroupDef.path = NULL;
108 rGroupDef.recordId = NULL;
109 rGroupDef.recordType = NULL;
110 rGroupDef.flagStoreData = -1;
111 rGroupDef.flagStoreKeys = -1;
116 fprintf (stderr, "index [-v log] [-m meg] [-c config] [-d base]"
117 " [-g group] [update|del dir] ...\n");
120 while ((ret = options ("t:c:g:v:m:d:", argv, argc, &arg)) != -2)
124 if(cmd == 0) /* command */
126 if (!strcmp (arg, "update"))
128 else if (!strcmp (arg, "del") || !strcmp(arg, "delete"))
132 logf (LOG_FATAL, "Unknown command: %s", arg);
138 struct recordGroup rGroup;
140 memcpy (&rGroup, &rGroupDef, sizeof(rGroup));
141 if (!common_resource)
143 common_resource = res_open (configName ?
144 configName : FNAME_CONFIG);
145 if (!common_resource)
147 logf (LOG_FATAL, "Cannot open resource `%s'",
151 data1_tabpath = res_get (common_resource, "profilePath");
152 assert (data1_tabpath);
161 repositoryUpdate (&rGroup);
163 repositoryDelete (&rGroup);
169 log_init (log_mask_str(arg), prog, NULL);
173 mem_max = 1024*1024*atoi(arg);
177 rGroupDef.databaseName = arg;
181 rGroupDef.groupName = arg;
186 rGroupDef.recordType = arg;
189 logf (LOG_FATAL, "Unknown option '-%s'", arg);
195 nsections = key_close ();
198 logf (LOG_LOG, "Merging with index");
199 key_input (FNAME_WORD_DICT, FNAME_WORD_ISAM, nsections, 60);