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