X-Git-Url: http://lists.indexdata.com/cgi-bin?a=blobdiff_plain;ds=sidebyside;f=src%2Fhttp_command.c;h=4575ef37da7443c5704e21d76a1fcd7f28afa23a;hb=07bc8f15f98e22a866adda001ada9010567b3429;hp=122bef5b440d6cd767f2632a07c1a2b11cee3988;hpb=b026a4535c9ce5e0d371f23f19f9a337963bc908;p=pazpar2-moved-to-github.git diff --git a/src/http_command.c b/src/http_command.c index 122bef5..4575ef3 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -943,7 +943,6 @@ static void show_record(struct http_channel *c, struct http_session *s) struct http_response *rs = c->response; struct http_request *rq = c->request; struct record_cluster *rec, *prev_r, *next_r; - struct record *r; struct conf_service *service; const char *idstr = http_argbyname(rq, "id"); const char *offsetstr = http_argbyname(rq, "offset"); @@ -990,18 +989,18 @@ static void show_record(struct http_channel *c, struct http_session *s) for (i = 0; r; r = r->next) if (v == r->checksum) break; + if (!r) + error(rs, PAZPAR2_RECORD_FAIL, "no record"); } else { int offset = atoi(offsetstr); for (i = 0; i < offset && r; r = r->next, i++) ; + if (!r) + error(rs, PAZPAR2_RECORD_FAIL, "no record at offset given"); } - if (!r) - { - error(rs, PAZPAR2_RECORD_FAIL, "no record at offset given"); - } - else + if (r) { http_channel_observer_t obs = http_add_observer(c, r->client, show_raw_reset); @@ -1023,6 +1022,7 @@ static void show_record(struct http_channel *c, struct http_session *s) } else { + struct record *r; response_open_no_status(c, "record"); wrbuf_puts(c->wrbuf, "\n"); wrbuf_xmlputs(c->wrbuf, rec->recid); @@ -1188,8 +1188,9 @@ static void cmd_show(struct http_channel *c) release_session(c, s); return; } - session_sort(s->psession, sp->name, sp->increasing, - sp->type == Metadata_sortkey_position); + session_sort(s->psession, sp->name, sp->increasing, 0); + /* TODO This was too simple. Will make pazpar2 continuing reseting the session resultset and redo the search. Disable this for now + sp->type == Metadata_sortkey_position */ status = session_active_clients(s->psession);