}
static void session_clear_set(struct session *se,
- const char *sort_field, int increasing)
+ const char *sort_field, int increasing, int position)
{
reclist_destroy(se->reclist);
se->reclist = 0;
se->sorted_results = nmem_malloc(se->nmem, sizeof(*se->sorted_results));
se->sorted_results->field = nmem_strdup(se->nmem, sort_field);
se->sorted_results->increasing = increasing;
+ se->sorted_results->position = position;
se->sorted_results->next = 0;
se->reclist = reclist_create(se->nmem);
}
-void session_sort(struct session *se, const char *field, int increasing, int clear_set)
+void session_sort(struct session *se, const char *field, int increasing,
+ int position)
{
struct session_sorted_results *sr;
struct client_list *l;
session_enter(se);
- yaz_log(YLOG_LOG, "session_sort field=%s", field);
- // TODO In order for this to work, clear_set may only be true on first call. Every following (poll) may not.
- // I do not think we can decide this from the outside of the session.
- // The logic should be when we change to/away from a native sort order,
- // it should cleared on the first call
- if (clear_set)
+ yaz_log(YLOG_LOG, "session_sort field=%s increasing=%d position=%d", field, increasing, position);
+ /* see if we already have sorted for this critieria */
+ /* TODO I do not see the point in saving all previous sorts. Dont we re-sort anyway ? */
+ for (sr = se->sorted_results; sr; sr = sr->next)
{
- session_clear_set(se, field, increasing);
+ if (!strcmp(field, sr->field) && increasing == sr->increasing && sr->position == position)
+ break;
}
- else
+ if (sr)
{
- /* see if we already have sorted for this critieria */
- for (sr = se->sorted_results; sr; sr = sr->next)
- {
- if (!strcmp(field, sr->field) && increasing == sr->increasing)
- break;
- }
- if (sr)
- {
- session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d already fetched",
- field, increasing);
- session_leave(se);
- return;
- }
- session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d must fetch",
- field, increasing);
- sr = nmem_malloc(se->nmem, sizeof(*sr));
- sr->field = nmem_strdup(se->nmem, field);
- sr->increasing = increasing;
- sr->next = se->sorted_results;
- se->sorted_results = sr;
+ session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d position=%d already fetched",
+ field, increasing, position);
+ session_leave(se);
+ return;
}
+ if (position)
+ {
+ session_clear_set(se, field, increasing, position);
+ }
+
+ session_log(se, YLOG_DEBUG, "search_sort: field=%s increasing=%d position=%d must fetch",
+ field, increasing, position);
+ sr = nmem_malloc(se->nmem, sizeof(*sr));
+ sr->field = nmem_strdup(se->nmem, field);
+ sr->increasing = increasing;
+ sr->position = position;
+ sr->next = se->sorted_results;
+ se->sorted_results = sr;
for (l = se->clients_active; l; l = l->next)
{
const char *filter,
const char *limit,
const char **addinfo,
- const char *sort_field, int increasing)
+ const char *sort_field,
+ int increasing)
{
int live_channels = 0;
int no_working = 0;
session_enter(se);
se->settings_modified = 0;
- session_clear_set(se, sort_field, increasing);
+ session_clear_set(se, sort_field, increasing, 0); /* hardcoded position */
relevance_destroy(&se->relevance);
live_channels = select_targets(se, filter);
http://localhost:9763/search.pz2?session=1&command=termlist&block=1&name=xtargets%2Cauthor%2Csubject%2Cdate
test_limit_limitmap_settings_2.xml http://localhost:9763/search.pz2?session=1&command=settings
http://localhost:9763/search.pz2?session=1&command=search&query=computer
-4 http://localhost:9763/search.pz2?session=1&command=show&block=1
+10 http://localhost:9763/search.pz2?session=1&command=show&block=1
http://localhost:9763/search.pz2?session=1&command=bytarget
http://localhost:9763/search.pz2?session=1&command=termlist&block=1&name=xtargets%2Cauthor%2Csubject%2Cdate
http://localhost:9763/search.pz2?session=1&command=termlist&block=1&report=status&name=xtargets%2Cauthor%2Csubject%2Cdate
1 http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3D1977
http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version2=
+http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3C1977
+http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3D1977-1997
+http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version2=
+http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3C1977
+http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=search&query=computer&limit=date%3D1977-1997
+http://localhost:9763/search.pz2?session=1&command=show&block=1&version=2
+http://localhost:9763/search.pz2?session=1&command=termlist&block=1&version2=
<set name="pz:limitmap:author" value="ccl:author_phrase" />
<set name="pz:limitmap:subject" value="rpn:@attr 1=subject_exact" />
- <set name="pz:limitmap:date" value="rpn:@attr 1=date @attr 6=3" />
+ <set name="pz:limitmap:date" value="ccl:date_exact" />
<set name="pz:limitmap:medium" value="rpn:@attr 1=medium_exact @attr 6=3" />
<set name="full_text_target" value="=NO" />
<set name="pz:cclmap:ti" value="1=title" />
<set name="pz:cclmap:au" value="1=author" />
<set name="pz:cclmap:author_phrase" value="1=author_exact 6=3"/>
- <set name="pz:xslt" value="solr-pz2.xsl" />
<set name="pz:cclmap:term" value="1=text s=Dal" />
<set name="pz:cclmap:isbn" value="1=isbn" />
+ <set name="pz:cclmap:date_exact" value="1=date_exact r=r" />
+ <set name="pz:xslt" value="solr-pz2.xsl" />
<set name="pz:queryencoding" value="UTF-8" />
</settings>