1 /* $Id: pazpar2.h,v 1.21 2007-04-10 08:48:56 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
93 struct zr_explain *explain;
94 struct setting **settings;
95 struct database *next;
98 struct database_retrievalmap *map;
101 // Normalization filter chain. Turns incoming record into internal representation
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 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 client *clients;
187 NMEM session_nmem; // Nmem for session-permanent storage
188 NMEM nmem; // Nmem for each operation (i.e. search, result set, etc)
189 WRBUF wrbuf; // Wrbuf for scratch(i.e. search)
191 struct named_termlist termlists[SESSION_MAX_TERMLISTS];
192 struct relevance *relevance;
193 struct reclist *reclist;
196 session_watchfun fun;
197 } watchlist[SESSION_WATCH_MAX + 1];
198 int expected_maxrecs;
206 int num_no_connection;
208 int num_initializing;
218 struct hitsbytarget {
229 char proxy_override[128];
230 char listener_override[128];
231 char zproxy_override[128];
232 char settings_path_override[128];
233 struct conf_server *server;
235 int timeout; /* operations timeout, in seconds */
236 char implementationId[128];
237 char implementationName[128];
238 char implementationVersion[128];
239 int target_timeout; // seconds
247 struct hitsbytarget *hitsbytarget(struct session *s, int *count);
248 int select_targets(struct session *se, struct database_criterion *crit);
249 struct session *new_session(NMEM nmem);
250 void destroy_session(struct session *s);
251 int load_targets(struct session *s, const char *fn);
252 void statistics(struct session *s, struct statistics *stat);
253 char *search(struct session *s, char *query, char *filter);
254 struct record_cluster **show(struct session *s, struct reclist_sortparms *sp, int start,
255 int *num, int *total, int *sumhits, NMEM nmem_show);
256 struct record_cluster *show_single(struct session *s, int id);
257 struct termlist_score **termlist(struct session *s, const char *name, int *num);
258 void session_set_watch(struct session *s, int what, session_watchfun fun, void *data);
259 int session_active_clients(struct session *s);
266 * indent-tabs-mode: nil
268 * vim: shiftwidth=4 tabstop=8 expandtab