Odr_int total_hits;
Odr_int approx_hits;
int i;
-
+ struct conf_service *service = 0;
if (!s)
return;
startn = atoi(start);
if (num)
numn = atoi(num);
- if (!sort)
- sort = "relevance";
- if (!(sp = reclist_parse_sortparms(c->nmem, sort, s->psession->service)))
+
+ service = s->psession->service;
+ if (!sort) {
+ sort = service->default_sort;
+ }
+ if (!(sp = reclist_parse_sortparms(c->nmem, sort, service)))
{
error(rs, PAZPAR2_MALFORMED_PARAMETER_VALUE, "sort");
return;
const char *block = http_argbyname(rq, "block");
const char *sort = http_argbyname(rq, "sort");
const char *block_error = http_argbyname(rq, "report");
+ struct conf_service *service = 0;
struct reclist_sortparms *sp;
int status;
if (!s)
return;
- if (!sort)
- sort = "relevance";
+ service = s->psession->service;
+ if (!sort) {
+ sort = service->default_sort;
+ }
- if (!(sp = reclist_parse_sortparms(c->nmem, sort, s->psession->service)))
+ if (!(sp = reclist_parse_sortparms(c->nmem, sort, service)))
{
error(c->response, PAZPAR2_MALFORMED_PARAMETER_VALUE, "sort");
release_session(c, s);
return;
}
session_sort(s->psession, sp->name, sp->increasing, sp->type == Metadata_sortkey_position);
- /* 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);
const char *maxrecs = http_argbyname(rq, "maxrecs");
const char *startrecs = http_argbyname(rq, "startrecs");
const char *limit = http_argbyname(rq, "limit");
+ const char *sort = http_argbyname(rq, "sort");
enum pazpar2_error_code code;
const char *addinfo = 0;
+ struct reclist_sortparms *sp;
if (!s)
return;
+
if (!query)
{
error(rs, PAZPAR2_MISSING_PARAMETER, "query");
release_session(c, 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;
+ }
+
code = session_search(s->psession, query, startrecs, maxrecs, filter, limit,
- &addinfo, "relevance", 0);
+ &addinfo, sp);
if (code)
{
error(rs, code, addinfo);