1 /* This file is part of Pazpar2.
2 Copyright (C) Index Data
4 Pazpar2 is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef PAZPAR2_CONFIG_H
21 #define PAZPAR2_CONFIG_H
23 #include "normalize_cache.h"
26 #include <yaz/mutex.h>
33 enum conf_metadata_type {
34 Metadata_type_generic, // Generic text field
35 Metadata_type_year, // year YYYY - YYYY
36 Metadata_type_date, // date YYYYMMDD - YYYYMMDD
37 Metadata_type_float, // float number
38 Metadata_type_skiparticle,
39 Metadata_type_relevance,
40 Metadata_type_position,
43 enum conf_metadata_merge {
44 Metadata_merge_no, // Don't merge
45 Metadata_merge_unique, // Include unique elements in merged block
46 Metadata_merge_longest, // Include the longest (strlen) value
47 Metadata_merge_range, // Store value as a range of lowest-highest
48 Metadata_merge_all, // Just include all elements found
49 Metadata_merge_first // All from first target
52 // This controls the ability to insert 'static' values from settings into retrieval recs
53 enum conf_setting_type {
55 Metadata_setting_postproc, // Insert setting value into normalized record
56 Metadata_setting_parameter // Expose value to normalization stylesheets
59 enum conf_metadata_mergekey {
61 Metadata_mergekey_optional,
62 Metadata_mergekey_required
65 // Describes known metadata elements and how they are to be manipulated
66 // An array of these structure provides a 'map' against which
67 // discovered metadata elements are matched. It also governs storage,
68 // to minimize number of cycles needed at various tages of processing
71 char *name; // The field name. Output by normalization stylesheet
72 int brief; // Is this element to be returned in the brief format?
73 int termlist;// Is this field to be treated as a termlist for browsing?
75 int sortkey_offset; // -1 if it's not a sortkey, otherwise index
76 // into service/record_cluster->sortkey array
77 enum conf_metadata_type type;
78 enum conf_metadata_merge merge;
79 enum conf_setting_type setting; // Value is to be taken from session/db settings?
80 enum conf_metadata_mergekey mergekey;
83 char *limitmap; // Should be expanded into service-wide default e.g. pz:limitmap:<name>=value setting
93 enum conf_metadata_type type;
98 // It is conceivable that there will eventually be several 'services'
99 // offered from one server, with separate configuration -- possibly
100 // more than one services associated with the same port. For now,
101 // however, only a single service is possible.
106 struct conf_metadata *metadata;
108 struct conf_sortkey *sortkeys;
109 struct setting_dictionary *dictionary;
110 struct settings_array *settings;
111 struct conf_service *next;
115 int z3950_session_timeout;
116 int z3950_operation_timeout;
125 /* duplicated from conf_server */
126 pp2_charset_fact_t charsets;
128 struct service_xslt *xslt_list;
130 CCL_bibset ccl_bibset;
131 struct database *databases;
132 struct conf_server *server;
136 int conf_service_metadata_field_id(struct conf_service *service, const char * name);
138 int conf_service_sortkey_field_id(struct conf_service *service, const char * name);
147 char *settings_fname;
150 pp2_charset_fact_t charsets;
152 struct conf_service *service;
153 struct conf_server *next;
154 struct conf_config *config;
155 http_server_t http_server;
156 iochan_man_t iochan_man;
157 database_hosts_t database_hosts;
160 struct conf_config *config_create(const char *fname, int verbose);
161 void config_destroy(struct conf_config *config);
162 void config_process_events(struct conf_config *config);
163 void info_services(struct conf_server *server, WRBUF w);
165 struct conf_service *locate_service(struct conf_server *server,
166 const char *service_id);
168 struct conf_service *service_create(struct conf_server *server,
170 void service_incref(struct conf_service *service);
171 void service_destroy(struct conf_service *service);
173 int config_start_listeners(struct conf_config *conf,
174 const char *listener_override,
175 const char *record_fname);
177 void config_stop_listeners(struct conf_config *conf);
179 WRBUF conf_get_fname(struct conf_config *config, const char *fname);
186 * c-file-style: "Stroustrup"
187 * indent-tabs-mode: nil
189 * vim: shiftwidth=4 tabstop=8 expandtab