predefined databases from configuration.
<!ENTITY % idcommon SYSTEM "common/common.ent">
%idcommon;
]>
-<!-- $Id: pazpar2_protocol.xml,v 1.9 2007-06-22 13:18:23 adam Exp $ -->
+<!-- $Id: pazpar2_protocol.xml,v 1.10 2007-06-28 09:36:11 adam Exp $ -->
<refentry id="pazpar2_protocol">
<refentryinfo>
<productname>Pazpar2</productname>
<para>
The init command may take a number of setting parameters, similar to
the 'settings' command described below. These settings are immediately
- applied to the new session.
+ applied to the new session. Other parameters for init are:
+ <variablelist>
+ <varlistentry>
+ <term>clear</term>
+ <listitem>
+ <para>
+ If this is defined and the value is non-zero, the session will
+ not use the predefined databases in the configuration; only those
+ specified in the settings parameters (per session databases).
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
</para>
</refsect2>
-/* $Id: database.c,v 1.28 2007-05-25 03:58:04 quinn Exp $
+/* $Id: database.c,v 1.29 2007-06-28 09:36:10 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
return i;
}
-int grep_databases(void *context, struct database_criterion *cl,
- void (*fun)(void *context, struct database *db))
+int predef_grep_databases(void *context, struct database_criterion *cl,
+ void (*fun)(void *context, struct database *db))
{
struct database *p;
int i = 0;
-/* $Id: database.h,v 1.7 2007-04-22 15:00:56 adam Exp $
+/* $Id: database.h,v 1.8 2007-06-28 09:36:10 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
int database_match_criteria(struct session_database *db, struct database_criterion *cl);
int session_grep_databases(struct session *se, struct database_criterion *cl,
void (*fun)(void *context, struct session_database *db));
-int grep_databases(void *context, struct database_criterion *cl,
- void (*fun)(void *context, struct database *db));
+int predef_grep_databases(void *context, struct database_criterion *cl,
+ void (*fun)(void *context, struct database *db));
int match_zurl(const char *zurl, const char *pattern);
#endif
-/* $Id: http_command.c,v 1.54 2007-06-15 19:35:17 adam Exp $
+/* $Id: http_command.c,v 1.55 2007-06-28 09:36:10 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
*/
/*
- * $Id: http_command.c,v 1.54 2007-06-15 19:35:17 adam Exp $
+ * $Id: http_command.c,v 1.55 2007-06-28 09:36:10 adam Exp $
*/
#include <stdio.h>
{
unsigned int sesid;
char buf[1024];
+ const char *clear = http_argbyname(c->request, "clear");
struct http_session *s = http_session_create();
struct http_response *rs = c->response;
yaz_log(YLOG_DEBUG, "HTTP Session init");
+ if (!clear || *clear == '0')
+ session_init_databases(s->psession);
+ else
+ yaz_log(YLOG_LOG, "No databases preloaded");
sesid = make_sessionid();
s->session_id = sesid;
if (process_settings(s->psession, c->request, c->response) < 0)
-/* $Id: logic.c,v 1.46 2007-06-19 10:16:15 adam Exp $
+/* $Id: logic.c,v 1.47 2007-06-28 09:36:10 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
void session_init_databases(struct session *se)
{
se->databases = 0;
- grep_databases(se, 0, session_init_databases_fun);
+ predef_grep_databases(se, 0, session_init_databases_fun);
}
// Probably session_init_databases_fun should be refactored instead of
session->session_nmem = nmem;
session->nmem = nmem_create();
session->wrbuf = wrbuf_alloc();
- session_init_databases(session);
+ session->databases = 0;
for (i = 0; i <= SESSION_WATCH_MAX; i++)
{
session->watchlist[i].data = 0;
-/* $Id: pazpar2.h,v 1.43 2007-06-18 11:10:20 adam Exp $
+/* $Id: pazpar2.h,v 1.44 2007-06-28 09:36:10 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
int select_targets(struct session *se, struct database_criterion *crit);
struct session *new_session(NMEM nmem);
void destroy_session(struct session *s);
+void session_init_databases(struct session *s);
int load_targets(struct session *s, const char *fn);
void statistics(struct session *s, struct statistics *stat);
enum pazpar2_error_code search(struct session *s, char *query,
-/* $Id: settings.c,v 1.23 2007-06-06 11:49:48 marc Exp $
+/* $Id: settings.c,v 1.24 2007-06-28 09:36:10 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
// This is used in pass 2 to assign name/value pairs to databases
static void update_databases(struct setting *set)
{
- grep_databases(set, 0, update_database);
+ predef_grep_databases(set, 0, update_database);
}
// This simply copies the 'hard' (application-specific) settings