X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp_command.c;h=f304e6131a8b52546c8655a373c9f847995f91eb;hb=bec266c19b530f61fa576d2b27198ada7d7f5fe3;hp=114d2ea704d363dda93377578f7a1302bbfffc7b;hpb=1e101aa1bfddbdbad0024f743ff71447cc432a11;p=pazpar2-moved-to-github.git diff --git a/src/http_command.c b/src/http_command.c index 114d2ea..f304e61 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -1,5 +1,5 @@ /* - * $Id: http_command.c,v 1.23 2007-01-17 14:21:29 quinn Exp $ + * $Id: http_command.c,v 1.26 2007-01-18 18:11:19 quinn Exp $ */ #include @@ -165,10 +165,10 @@ static void targets_termlist(WRBUF wrbuf, struct session *se, int num) if (!(ht = hitsbytarget(se, &count))) return; qsort(ht, count, sizeof(struct hitsbytarget), cmp_ht); - for (i = 0; i < count && i < num; i++) + for (i = 0; i < count && i < num && ht[i].hits > 0; i++) { wrbuf_puts(wrbuf, "\n\n"); - wrbuf_printf(wrbuf, "%s\n", ht[i].id); + wrbuf_printf(wrbuf, "%s\n", ht[i].name); wrbuf_printf(wrbuf, "%d\n", ht[i].hits); wrbuf_printf(wrbuf, "%s\n", ht[i].state); wrbuf_printf(wrbuf, "%d\n", ht[i].diagnostic); @@ -307,12 +307,22 @@ static void write_metadata(WRBUF w, struct conf_service *service, } } +static void write_subrecord(struct record *r, WRBUF w, struct conf_service *service) +{ + wrbuf_printf(w, "\n", + r->client->database->url, + r->client->database->name ? r->client->database->name : ""); + write_metadata(w, service, r->metadata, 1); + wrbuf_puts(w, "\n"); +} + static void cmd_record(struct http_channel *c) { struct http_response *rs = c->response; struct http_request *rq = c->request; struct http_session *s = locate_session(rq, rs); struct record_cluster *rec; + struct record *r; struct conf_service *service = global_parameters.server->service; char *idstr = http_argbyname(rq, "id"); int id; @@ -334,6 +344,8 @@ static void cmd_record(struct http_channel *c) wrbuf_puts(c->wrbuf, "\n"); wrbuf_printf(c->wrbuf, "%d", rec->recid); write_metadata(c->wrbuf, service, rec->metadata, 1); + for (r = rec->records; r; r = r->next) + write_subrecord(r, c->wrbuf, service); wrbuf_puts(c->wrbuf, "\n"); rs->payload = nmem_strdup(c->nmem, wrbuf_buf(c->wrbuf)); http_send_response(c);