X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp_command.c;h=752c3295452bb3baf26c282933789dd3235a90a3;hb=e21851ef5461875e3929605afe79f23be86c2404;hp=6c68ae4e680155e549ebd6775707aabf1132188a;hpb=8cea11ee29fe71f11f61d1d05295b4e4290f6a98;p=pazpar2-moved-to-github.git
diff --git a/src/http_command.c b/src/http_command.c
index 6c68ae4..752c329 100644
--- a/src/http_command.c
+++ b/src/http_command.c
@@ -472,6 +472,7 @@ static void cmd_bytarget(struct http_channel *c)
struct http_request *rq = c->request;
struct http_session *s = locate_session(rq, rs);
struct hitsbytarget *ht;
+ const char *settings = http_argbyname(rq, "settings");
int count, i;
if (!s)
@@ -502,8 +503,14 @@ static void cmd_bytarget(struct http_channel *c)
wrbuf_puts(c->wrbuf, "");
wrbuf_xmlputs(c->wrbuf, ht[i].state);
wrbuf_puts(c->wrbuf, "\n");
-
+ if (settings && *settings == '1')
+ {
+ wrbuf_puts(c->wrbuf, "\n");
+ wrbuf_puts(c->wrbuf, wrbuf_cstr(ht[i].settings_xml));
+ wrbuf_puts(c->wrbuf, "\n");
+ }
wrbuf_puts(c->wrbuf, "");
+ wrbuf_destroy(ht[i].settings_xml);
}
wrbuf_puts(c->wrbuf, "");
@@ -524,8 +531,16 @@ static void write_metadata(WRBUF w, struct conf_service *service,
continue;
for (md = ml[imeta]; md; md = md->next)
{
- wrbuf_printf(w, "\n", cmd->name);
+ struct record_metadata_attr *attr = md->attributes;
+ wrbuf_printf(w, "\nname);
+ for (; attr; attr = attr->next)
+ {
+ wrbuf_printf(w, " %s=\"", attr->name);
+ wrbuf_xmlputs(w, attr->value);
+ wrbuf_puts(w, "\"");
+ }
+ wrbuf_puts(w, ">");
switch (cmd->type)
{
case Metadata_type_generic:
@@ -812,7 +827,7 @@ static void cmd_show(struct http_channel *c)
if (block)
{
- if (status && (!s->psession->reclist || !s->psession->reclist->num_records))
+ if (status && reclist_get_num_records(s->psession->reclist) == 0)
{
// if there is already a watch/block. we do not block this one
if (session_set_watch(s->psession, SESSION_WATCH_SHOW,
@@ -870,6 +885,8 @@ static void cmd_search(struct http_channel *c)
struct http_session *s = locate_session(rq, rs);
const char *query = http_argbyname(rq, "query");
const char *filter = http_argbyname(rq, "filter");
+ const char *maxrecs = http_argbyname(rq, "maxrecs");
+ const char *startrecs = http_argbyname(rq, "startrecs");
enum pazpar2_error_code code;
const char *addinfo = 0;
@@ -885,7 +902,7 @@ static void cmd_search(struct http_channel *c)
error(rs, PAZPAR2_MALFORMED_PARAMETER_ENCODING, "query");
return;
}
- code = search(s->psession, query, filter, &addinfo);
+ code = search(s->psession, query, startrecs, maxrecs, filter, &addinfo);
if (code)
{
error(rs, code, addinfo);