-/* $Id: client.c,v 1.18 2007-08-17 12:39:11 adam Exp $
+/* $Id: client.c,v 1.19 2007-09-05 08:40:12 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
continue;
}
if (rlist->num_records)
- session_alert_watch(s, SESSION_WATCH_RECORDS);
+ session_alert_watch(s, SESSION_WATCH_SHOW);
+ if (rlist->num_records)
+ session_alert_watch(s, SESSION_WATCH_RECORD);
#if USE_TIMING
yaz_timing_stop(t);
-/* $Id: http_command.c,v 1.59 2007-09-05 07:24:04 adam Exp $
+/* $Id: http_command.c,v 1.60 2007-09-05 08:40:12 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
*/
/*
- * $Id: http_command.c,v 1.59 2007-09-05 07:24:04 adam Exp $
+ * $Id: http_command.c,v 1.60 2007-09-05 08:40:12 adam Exp $
*/
#include <stdio.h>
client_show_raw_reset(client);
}
+static void cmd_record_ready(void *data);
+
static void cmd_record(struct http_channel *c)
{
struct http_response *rs = c->response;
wrbuf_rewind(c->wrbuf);
if (!(rec = show_single(s->psession, idstr)))
{
- error(rs, PAZPAR2_RECORD_MISSING, idstr);
+ if (session_set_watch(s->psession, SESSION_WATCH_RECORD,
+ cmd_record_ready, c, c) != 0)
+ {
+ error(rs, PAZPAR2_RECORD_MISSING, idstr);
+ }
return;
}
if (offsetstr)
}
}
+static void cmd_record_ready(void *data)
+{
+ struct http_channel *c = (struct http_channel *) data;
+
+ yaz_log(YLOG_LOG, "cmd_records_ready chan=%p", c);
+ cmd_record(c);
+}
+
static void show_records(struct http_channel *c, int active)
{
struct http_request *rq = c->request;
if (status && (!s->psession->reclist || !s->psession->reclist->num_records))
{
// if there is already a watch/block. we do not block this one
- if (session_set_watch(s->psession,
- SESSION_WATCH_RECORDS,
- show_records_ready, c, c) == 0)
+ if (session_set_watch(s->psession, SESSION_WATCH_SHOW,
+ show_records_ready, c, c) != 0)
{
yaz_log(YLOG_DEBUG, "Blocking on cmd_show");
- return;
}
+ return;
}
}
-/* $Id: logic.c,v 1.63 2007-09-05 07:24:04 adam Exp $
+/* $Id: logic.c,v 1.64 2007-09-05 08:40:12 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
void session_alert_watch(struct session *s, int what)
{
- if (!s->watchlist[what].fun)
- return;
- http_remove_observer(s->watchlist[what].obs);
- (*s->watchlist[what].fun)(s->watchlist[what].data);
- s->watchlist[what].fun = 0;
- s->watchlist[what].data = 0;
- s->watchlist[what].obs = 0;
+ if (s->watchlist[what].fun)
+ {
+ /* our watch is no longer associated with http_channel */
+ http_remove_observer(s->watchlist[what].obs);
+ session_watchfun fun = s->watchlist[what].fun;
+ void *data = s->watchlist[what].data;
+
+ /* reset watch before fun is invoked - in case fun wants to set
+ it again */
+ s->watchlist[what].fun = 0;
+ s->watchlist[what].data = 0;
+ s->watchlist[what].obs = 0;
+
+ fun(data);
+ }
}
//callback for grep_databases
-/* $Id: pazpar2.h,v 1.48 2007-09-05 07:24:04 adam Exp $
+/* $Id: pazpar2.h,v 1.49 2007-09-05 08:40:12 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
struct session_database *next;
};
-#define SESSION_WATCH_RECORDS 0
-#define SESSION_WATCH_MAX 0
+
+
+#define SESSION_WATCH_SHOW 0
+#define SESSION_WATCH_RECORD 1
+#define SESSION_WATCH_MAX 1
#define SESSION_MAX_TERMLISTS 10
--- /dev/null
+<search><status>OK</status></search>
\ No newline at end of file
--- /dev/null
+<record>
+<recid>title how to program a computer author jack collins medium book</recid>
+
+<md-title>How to program a computer</md-title>
+<md-author>Jack Collins</md-author>
+<md-lccn>11224467</md-lccn>
+<md-lccn>11224466</md-lccn><location id="z3950.indexdata.com/marc" name="Local Test">
+<md-title>How to program a computer</md-title>
+<md-author>Jack Collins</md-author>
+<md-id>11224467</md-id>
+<md-lccn>11224467</md-lccn>
+<md-test-usersetting>XXXXXXXXXX</md-test-usersetting>
+<md-test_usersetting_2>Shit:
+ YYYYYYYYY</md-test_usersetting_2></location>
+<location id="z3950.indexdata.com/marc" name="Local Test">
+<md-title>How to program a computer</md-title>
+<md-author>Jack Collins</md-author>
+<md-id>11224466</md-id>
+<md-lccn>11224466</md-lccn>
+<md-test-usersetting>XXXXXXXXXX</md-test-usersetting>
+<md-test_usersetting_2>Shit:
+ YYYYYYYYY</md-test_usersetting_2></location>
+</record>
http://localhost:9763/search.pz2?session=2&command=show&start=0&number=1&block=1
http://localhost:9763/search.pz2?session=2&command=search&query=kubiak%20stanis%C5%82aw
http://localhost:9763/search.pz2?session=2&command=search&query=kubiak%20sts%C5%82aw
+2
http://localhost:9763/search.pz2?session=2&command=bytarget
-
+http://localhost:9763/search.pz2?session=1&command=search&query=computer
+http://localhost:9763/search.pz2?session=1&command=record&id=title+how+to+program+a+computer+author+jack+collins+medium+book