- if (se->sorted_results)
- { /* first entry is current sorting ! */
- const char *sort_strategy_and_spec =
- get_strategy_plus_sort(cl, se->sorted_results->name);
- int increasing = se->sorted_results->increasing;
- // int position = se->sorted_results->type;
- if (sort_strategy_and_spec && strlen(sort_strategy_and_spec) < 40)
- {
- char spec[50], *p;
- strcpy(spec, sort_strategy_and_spec);
- p = strchr(spec, ':');
- if (p)
- {
- *p++ = '\0'; /* cut the string in two */
- while (*p == ' ')
- p++;
- if (increasing)
- strcat(p, " <");
- else
- strcat(p, " >");
- yaz_log(YLOG_LOG, "Client %s: applying sorting %s %s", client_get_id(cl), spec, p);
- ZOOM_query_sortby2(query, spec, p);
- }
- }
- else
- {
- /* no native sorting.. If this is not the first search, then skip it entirely */
- if (se->sorted_results->next)
- {
- // TODO this seems wrong. Need to re-ingest instead?
- yaz_log(YLOG_DEBUG,"Client %s: Do not (re)search anyway", client_get_id(cl));
- ZOOM_query_destroy(query);
- return;
- }
- }
- }