Key input and merge sort in one pass.
[idzebra-moved-to-github.git] / index / index.h
1 /*
2  * Copyright (C) 1994-1995, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: index.h,v $
7  * Revision 1.15  1995-10-04 16:57:19  adam
8  * Key input and merge sort in one pass.
9  *
10  * Revision 1.14  1995/09/29  14:01:40  adam
11  * Bug fixes.
12  *
13  * Revision 1.13  1995/09/28  14:22:56  adam
14  * Sort uses smaller temporary files.
15  *
16  * Revision 1.12  1995/09/28  12:10:32  adam
17  * Bug fixes. Field prefix used in queries.
18  *
19  * Revision 1.11  1995/09/27  12:22:28  adam
20  * More work on extract in record control.
21  * Field name is not in isam keys but in prefix in dictionary words.
22  *
23  * Revision 1.10  1995/09/14  07:48:23  adam
24  * Record control management.
25  *
26  * Revision 1.9  1995/09/11  13:09:33  adam
27  * More work on relevance feedback.
28  *
29  * Revision 1.8  1995/09/08  14:52:27  adam
30  * Minor changes. Dictionary is lower case now.
31  *
32  * Revision 1.7  1995/09/06  16:11:16  adam
33  * Option: only one word key per file.
34  *
35  * Revision 1.6  1995/09/05  15:28:39  adam
36  * More work on search engine.
37  *
38  * Revision 1.5  1995/09/04  12:33:42  adam
39  * Various cleanup. YAZ util used instead.
40  *
41  * Revision 1.4  1995/09/04  09:10:35  adam
42  * More work on index add/del/update.
43  * Merge sort implemented.
44  * Initial work on z39 server.
45  *
46  * Revision 1.3  1995/09/01  14:06:35  adam
47  * Split of work into more files.
48  *
49  * Revision 1.2  1995/09/01  10:30:24  adam
50  * More work on indexing. Not working yet.
51  *
52  * Revision 1.1  1995/08/31  14:50:24  adam
53  * New simple file index tool.
54  *
55  */
56
57 #include <alexutil.h>
58 #include <dict.h>
59 #include <isam.h>
60
61 #define IT_MAX_WORD 256
62 #define IT_KEY_HAVE_SEQNO 1
63 #define IT_KEY_HAVE_FIELD 0
64
65 struct it_key {
66     int   sysno : 24;
67     int   seqno : 16;
68 };
69
70 struct dir_entry {
71     char *name;
72 };
73
74 struct dir_entry *dir_open (const char *rep);
75 void dir_sort (struct dir_entry *e);
76 void dir_free (struct dir_entry **e_p);
77 void repository (int cmd, const char *rep, const char *base_path);
78
79 void file_extract (int cmd, const char *fname, const char *kname);
80
81 void key_open (int mem);
82 int key_close (void);
83 void key_write (int cmd, struct it_key *k, const char *str);
84 int key_compare (const void *p1, const void *p2);
85 int key_qsort_compare (const void *p1, const void *p2);
86 void key_logdump (int mask, const void *p);
87 void key_input (const char *dict_fname, const char *isam_fname, 
88                 const char *key_fname, int cache);
89 void key_input2 (const char *dict_fname, const char *isam_fname,
90                  int nkeys, int cache);
91 int merge_sort (char **buf, int from, int to);
92
93 #define TEMP_FNAME  "keys%d.tmp"
94 #define FNAME_WORD_DICT "worddict"
95 #define FNAME_WORD_ISAM "wordisam"
96 #define FNAME_FILE_DICT "filedict"
97 #define FNAME_SYS_IDX "sysidx"
98 #define SYS_IDX_ENTRY_LEN 120
99
100 struct strtab *strtab_mk (void);
101 int strtab_src (struct strtab *t, const char *name, void ***infop);
102 void strtab_del (struct strtab *t,
103                  void (*func)(const char *name, void *info, void *data),
104                  void *data);
105 int index_char_cvt (int c);
106 int index_word_prefix (char *string, int attrSet, int attrUse);