Fixed bug related to ranking, introduced by 'metadata' update.
[pazpar2-moved-to-github.git] / src / config.h
1 #ifndef CONFIG_H
2 #define CONFIG_H
3
4 #include <libxslt/xslt.h>
5 #include <libxslt/transform.h>
6 #include <libxslt/xsltutils.h>
7
8 // Describes known metadata elements and how they are to be manipulated
9 struct conf_metadata 
10 {
11     char *name;  // The name of this element. Output by normalization stylesheet
12     int brief;   // Is this element to be returned in the brief format?
13     int termlist;// Is this field to be treated as a termlist for browsing?
14     int rank;    // Rank factor. 0 means don't use this field for ranking, 1 is default
15     enum
16     {
17         Metadata_type_generic,          // Generic text field
18         Metadata_type_integer,          // Integer type
19         Metadata_type_year              // A year
20     } type;
21     enum
22     {
23         Metadata_sortkey_no,            // This is not to be used as a sortkey
24         Metadata_sortkey_numeric,       // Standard numerical sorting
25         Metadata_sortkey_range,         // Range sorting (pick lowest or highest)
26         Metadata_sortkey_skiparticle    // Skip leading article when sorting
27     } sortkey;
28     enum
29     {
30         Metadata_merge_no,              // Don't merge
31         Metadata_merge_unique,          // Include unique elements in merged block
32         Metadata_merge_longest,         // Include the longest (strlen) value
33         Metadata_merge_range,           // Store value as a range of lowest-highest
34         Metadata_merge_all              // Just include all elements found
35     } merge;
36 };
37
38 struct conf_service
39 {
40     int num_metadata;
41     struct conf_metadata *metadata;
42 };
43
44 struct conf_server
45 {
46     char *host;
47     int port;
48     char *proxy_host;
49     int proxy_port;
50     struct conf_service *service;
51     struct conf_server *next;
52 };
53
54 struct conf_queryprofile
55 {
56 };
57
58 struct conf_retrievalmap
59 {
60     enum {
61         Map_xslt
62     } type;
63     char *charset;
64     char *format;
65     xsltStylesheet *stylesheet;
66     struct conf_retrievalmap *next;
67 };
68
69 struct conf_retrievalprofile
70 {
71     char *requestsyntax;
72     enum {
73         Nativesyn_xml,
74         Nativesyn_iso2709
75     } native_syntax;
76     enum {
77         Nativeform_na,
78         Nativeform_marc21,
79     } native_format;
80     char *native_encoding;
81     enum {
82         Nativemapto_na,
83         Nativemapto_marcxml,
84         Nativemapto_marcxchange
85     } native_mapto;
86     yaz_marc_t yaz_marc;
87     struct conf_retrievalmap *maplist;
88     struct conf_retrievalprofile *next;
89 };
90
91 struct conf_config
92 {
93     struct conf_server *servers;
94     struct conf_queryprofile *queryprofiles;
95     struct conf_retrievalprofile *retrievalprofiles;
96 };
97
98 #ifndef CONFIG_NOEXTERNS
99
100 extern struct conf_config *config;
101
102 #endif
103
104 int read_config(const char *fname);
105
106 #endif
107
108 /*
109  * Local variables:
110  * c-basic-offset: 4
111  * indent-tabs-mode: nil
112  * End:
113  * vim: shiftwidth=4 tabstop=8 expandtab
114  */