X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fhttp_command.c;h=7b296c729eeeff01f7ba9080981d20537b8f797a;hb=672671bc6cbcd0021171ce110bab5bb463905fb2;hp=7f7f98a7948ba0104ae80e7785dca71ca018e84b;hpb=69277f297f927ad4639025ce4f58460ffd548bdf;p=pazpar2-moved-to-github.git
diff --git a/src/http_command.c b/src/http_command.c
index 7f7f98a..7b296c7 100644
--- a/src/http_command.c
+++ b/src/http_command.c
@@ -126,7 +126,7 @@ void http_sessions_destroy(http_sessions_t hs)
{
struct http_session *s_next = s->next;
iochan_destroy(s->timeout_iochan);
- destroy_session(s->psession);
+ session_destroy(s->psession);
nmem_destroy(s->nmem);
s = s_next;
}
@@ -199,7 +199,7 @@ void http_session_destroy(struct http_session *s)
{ /* destroying for real */
yaz_log(http_sessions->log_level, "%p HTTP Session %u destroyed", s, s->session_id);
iochan_destroy(s->timeout_iochan);
- destroy_session(s->psession);
+ session_destroy(s->psession);
http_session_use(-1);
nmem_destroy(s->nmem);
}
@@ -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)->database->url);
+ 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);
}