1 /* $Id: pazpar2.h,v 1.24 2007-04-16 09:03:25 adam 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
29 #include <libxslt/xsltutils.h>
30 #include <libxslt/transform.h>
32 #include <yaz/comstack.h>
33 #include <yaz/pquery.h>
35 #include <yaz/yaz-ccl.h>
37 #include "termlists.h"
38 #include "relevance.h"
53 struct record_metadata {
54 union data_types data;
55 struct record_metadata *next; // next item of this name
59 struct client *client;
60 struct record_metadata **metadata; // Array mirrors list of metadata fields in config
61 union data_types **sortkeys; // Array mirrors list of sortkey fields in config
62 struct record *next; // Next in cluster of merged records
67 struct record_metadata **metadata; // Array mirrors list of metadata fields in config
68 union data_types **sortkeys;
71 int *term_frequency_vec;
72 int recid; // Set-specific ID for this record
73 struct record *records;
78 // Represents a host (irrespective of databases)
82 struct connection *connections; // All connections to this
86 // Represents a (virtual) database on a host
92 struct zr_explain *explain;
93 struct setting **settings;
94 struct database *next;
97 struct database_retrievalmap *map;
100 // Normalization filter. Turns incoming record into internal representation
101 // Simple sequence of stylesheets run in series.
102 struct database_retrievalmap {
103 xsltStylesheet *stylesheet;
104 struct database_retrievalmap *next;
107 struct database_criterion_value {
109 struct database_criterion_value *next;
112 struct database_criterion {
114 struct database_criterion_value *values;
115 struct database_criterion *next;
118 // Represents a physical, reusable connection to a remote Z39.50 host
123 struct client *client;
131 struct connection *next;
134 // Represents client state for a connection to one search target
136 struct session_database *database;
137 struct connection *connection;
138 struct session *session;
142 int requestid; // ID of current outstanding request
160 #define SESSION_WATCH_RECORDS 0
161 #define SESSION_WATCH_MAX 0
163 #define SESSION_MAX_TERMLISTS 10
165 typedef void (*session_watchfun)(void *data);
167 struct named_termlist
170 struct termlist *termlist;
173 // Represents a database as viewed from one session, possibly with settings overriden
174 // for that session (to support authorization/authentication)
175 struct session_database
177 struct database *database;
178 struct setting **settings;
179 struct session_database *next;
184 struct session_database *databases; // All databases, settings overriden
185 struct client *clients; // Clients connected for current search
188 NMEM session_nmem; // Nmem for session-permanent storage
189 NMEM nmem; // Nmem for each operation (i.e. search, result set, etc)
190 WRBUF wrbuf; // Wrbuf for scratch(i.e. search)
192 struct named_termlist termlists[SESSION_MAX_TERMLISTS];
193 struct relevance *relevance;
194 struct reclist *reclist;
197 session_watchfun fun;
198 } watchlist[SESSION_WATCH_MAX + 1];
199 int expected_maxrecs;
207 int num_no_connection;
209 int num_initializing;
219 struct hitsbytarget {
230 char proxy_override[128];
231 char listener_override[128];
232 char zproxy_override[128];
233 char settings_path_override[128];
234 struct conf_server *server;
236 int timeout; /* operations timeout, in seconds */
237 char implementationId[128];
238 char implementationName[128];
239 char implementationVersion[128];
240 int target_timeout; // seconds
248 struct hitsbytarget *hitsbytarget(struct session *s, int *count);
249 int select_targets(struct session *se, struct database_criterion *crit);
250 struct session *new_session(NMEM nmem);
251 void destroy_session(struct session *s);
252 int load_targets(struct session *s, const char *fn);
253 void statistics(struct session *s, struct statistics *stat);
254 char *search(struct session *s, char *query, char *filter);
255 struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start,
256 int *num, int *total, int *sumhits, NMEM nmem_show);
257 struct record_cluster *show_single(struct session *s, int id);
258 struct termlist_score **termlist(struct session *s, const char *name, int *num);
259 void session_set_watch(struct session *s, int what, session_watchfun fun, void *data);
260 int session_active_clients(struct session *s);
261 void session_apply_setting(struct session *se, char *dbname, char *setting, char *value);
262 char *session_setting_oneval(struct session_database *db, int offset);
264 void start_http_listener(void);
265 void start_proxy(void);
266 void start_zproxy(void);
268 extern struct parameters global_parameters;
269 extern IOCHAN channel_list;
276 * indent-tabs-mode: nil
278 * vim: shiftwidth=4 tabstop=8 expandtab