X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp_command.c;h=a86aabbee09bf18278bf20cc87aad8ddfec2a073;hb=ebc05bf9ed7336e6341bd94a07fa07063accc24b;hp=a4f7405b5905d7294ab80389761af815921a77e7;hpb=44981e9f52420f6a42bb1ac55712f74a31d17020;p=pazpar2-moved-to-github.git diff --git a/src/http_command.c b/src/http_command.c index a4f7405..a86aabb 100644 --- a/src/http_command.c +++ b/src/http_command.c @@ -642,6 +642,11 @@ static void cmd_bytarget(struct http_channel *c) wrbuf_puts(c->wrbuf, ht[i].settings_xml); wrbuf_puts(c->wrbuf, "\n"); } + if (ht[i].suggestions_xml && ht[i].suggestions_xml[0]) { + wrbuf_puts(c->wrbuf, ""); + wrbuf_puts(c->wrbuf, ht[i].suggestions_xml); + wrbuf_puts(c->wrbuf, ""); + } wrbuf_puts(c->wrbuf, ""); } response_close(c, "bytarget"); @@ -696,7 +701,7 @@ static void write_subrecord(struct record *r, WRBUF w, client_get_database(r->client), PZ_NAME); wrbuf_puts(w, "client)); + wrbuf_xmlputs(w, client_get_id(r->client)); wrbuf_puts(w, "\" "); wrbuf_puts(w, "name=\""); @@ -898,6 +903,7 @@ static void show_records(struct http_channel *c, int active) error(rs, PAZPAR2_MALFORMED_PARAMETER_VALUE, "sort"); release_session(c, s); return; + } @@ -950,11 +956,24 @@ static void cmd_show(struct http_channel *c) struct http_request *rq = c->request; struct http_session *s = locate_session(c); const char *block = http_argbyname(rq, "block"); + const char *sort = http_argbyname(rq, "sort"); + struct reclist_sortparms *sp; int status; if (!s) return; + if (!sort) + sort = "relevance"; + + if (!(sp = reclist_parse_sortparms(c->nmem, sort, s->psession->service))) + { + error(c->response, PAZPAR2_MALFORMED_PARAMETER_VALUE, "sort"); + release_session(c, s); + return; + } + session_sort(s->psession, sp->name, sp->increasing); + status = session_active_clients(s->psession); if (block) @@ -972,7 +991,7 @@ static void cmd_show(struct http_channel *c) return; } - else if (status && reclist_get_num_records(s->psession->reclist) == 0) + else if (status) { // if there is already a watch/block. we do not block this one if (session_set_watch(s->psession, SESSION_WATCH_SHOW, @@ -1025,8 +1044,8 @@ static void cmd_search(struct http_channel *c) release_session(c, s); return; } - code = search(s->psession, query, startrecs, maxrecs, filter, limit, - &addinfo); + code = session_search(s->psession, query, startrecs, maxrecs, filter, limit, + &addinfo, "relevance", 0); if (code) { error(rs, code, addinfo); @@ -1035,7 +1054,6 @@ static void cmd_search(struct http_channel *c) } response_open(c, "search"); response_close(c, "search"); - http_send_response(c); release_session(c, s); }