1 /* $Id: config.h,v 1.26 2007-07-30 11:52:08 quinn Exp $
2 Copyright (c) 2006-2007, Index Data.
4 This file is part of Pazpar2.
6 Pazpar2 is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2, or (at your option) any later
11 Pazpar2 is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 You should have received a copy of the GNU General Public License
17 along with Pazpar2; see the file LICENSE. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
25 #include <libxslt/xslt.h>
26 #include <libxslt/transform.h>
27 #include <libxslt/xsltutils.h>
36 enum conf_metadata_type {
37 Metadata_type_generic, // Generic text field
38 Metadata_type_number, // A number
39 Metadata_type_year // A number
42 enum conf_metadata_merge {
43 Metadata_merge_no, // Don't merge
44 Metadata_merge_unique, // Include unique elements in merged block
45 Metadata_merge_longest, // Include the longest (strlen) value
46 Metadata_merge_range, // Store value as a range of lowest-highest
47 Metadata_merge_all // Just include all elements found
50 enum conf_sortkey_type {
51 Metadata_sortkey_relevance,
52 Metadata_sortkey_numeric, // Standard numerical sorting
53 Metadata_sortkey_skiparticle, // Skip leading article when sorting
54 Metadata_sortkey_string // Flat string
57 // This controls the ability to insert 'static' values from settings into retrieval recs
58 enum conf_setting_type {
60 Metadata_setting_postproc, // Insert setting value into normalized record
61 Metadata_setting_parameter // Expose value to normalization stylesheets
64 // Describes known metadata elements and how they are to be manipulated
65 // An array of these structure provides a 'map' against which
66 // discovered metadata elements are matched. It also governs storage,
67 // to minimize number of cycles needed at various tages of processing
70 char *name; // The field name. Output by normalization stylesheet
71 int brief; // Is this element to be returned in the brief format?
72 int termlist;// Is this field to be treated as a termlist for browsing?
73 int rank; // Rank factor. 0 means don't use this field for ranking,
75 // values >1 give additional significance to a field
76 int sortkey_offset; // -1 if it's not a sortkey, otherwise index
77 // into service/record_cluster->sortkey array
78 enum conf_metadata_type type;
79 enum conf_metadata_merge merge;
80 enum conf_setting_type setting; // Value is to be taken from session/db settings?
85 struct conf_metadata * conf_metadata_assign(NMEM nmem,
86 struct conf_metadata * metadata,
88 enum conf_metadata_type type,
89 enum conf_metadata_merge merge,
90 enum conf_setting_type setting,
102 enum conf_sortkey_type type;
105 struct conf_sortkey * conf_sortkey_assign(NMEM nmem,
106 struct conf_sortkey * sortkey,
108 enum conf_sortkey_type type);
112 // It is conceivable that there will eventually be several 'services'
113 // offered from one server, with separate configuration -- possibly
114 // more than one services associated with the same port. For now,
115 // however, only a single service is possible.
119 struct conf_metadata *metadata;
121 struct conf_sortkey *sortkeys;
125 struct conf_service * conf_service_create(NMEM nmem,
126 int num_metadata, int num_sortkeys);
129 struct conf_metadata* conf_service_add_metadata(NMEM nmem,
130 struct conf_service *service,
133 enum conf_metadata_type type,
134 enum conf_metadata_merge merge,
135 enum conf_setting_type setting,
141 struct conf_sortkey * conf_service_add_sortkey(NMEM nmem,
142 struct conf_service *service,
145 enum conf_sortkey_type type);
148 int conf_service_metadata_field_id(struct conf_service *service, const char * name);
150 int conf_service_sortkey_field_id(struct conf_service *service, const char * name);
163 struct icu_chain * icu_chn;
166 struct conf_service *service;
167 struct conf_server *next;
170 struct conf_targetprofiles
180 struct conf_server *servers;
181 struct conf_targetprofiles *targetprofiles;
184 #ifndef CONFIG_NOEXTERNS
186 extern struct conf_config *config;
190 int read_config(const char *fname);
191 xsltStylesheet *conf_load_stylesheet(const char *fname);
198 * indent-tabs-mode: nil
200 * vim: shiftwidth=4 tabstop=8 expandtab