-/* $Id: logic.c,v 1.41 2007-06-13 08:04:03 adam Exp $
+/* $Id: logic.c,v 1.43 2007-06-13 21:29:04 adam Exp $
Copyright (c) 2006-2007, Index Data.
This file is part of Pazpar2.
{
struct session_database *sdb;
- yaz_log(YLOG_LOG, "Destroying session");
while (s->clients)
client_destroy(s->clients);
for (sdb = s->databases; sdb; sdb = sdb->next)
yaz_log(YLOG_DEBUG, "New Pazpar2 session");
+ session->relevance = 0;
session->total_hits = 0;
session->total_records = 0;
session->num_termlists = 0;
yaz_timing_t t = yaz_timing_create();
#endif
- for (spp = sp; spp; spp = spp->next)
- if (spp->type == Metadata_sortkey_relevance)
- {
- relevance_prepare_read(s->relevance, s->reclist);
- break;
- }
- reclist_sort(s->reclist, sp);
-
- *total = s->reclist->num_records;
- *sumhits = s->total_hits;
-
- for (i = 0; i < start; i++)
- if (!reclist_read_record(s->reclist))
- {
- *num = 0;
- recs = 0;
- break;
- }
-
- for (i = 0; i < *num; i++)
+ if (!s->relevance)
+ {
+ *num = 0;
+ *total = 0;
+ *sumhits = 0;
+ recs = 0;
+ }
+ else
{
- struct record_cluster *r = reclist_read_record(s->reclist);
- if (!r)
+ for (spp = sp; spp; spp = spp->next)
+ if (spp->type == Metadata_sortkey_relevance)
+ {
+ relevance_prepare_read(s->relevance, s->reclist);
+ break;
+ }
+ reclist_sort(s->reclist, sp);
+
+ *total = s->reclist->num_records;
+ *sumhits = s->total_hits;
+
+ for (i = 0; i < start; i++)
+ if (!reclist_read_record(s->reclist))
+ {
+ *num = 0;
+ recs = 0;
+ break;
+ }
+
+ for (i = 0; i < *num; i++)
{
- *num = i;
- break;
+ struct record_cluster *r = reclist_read_record(s->reclist);
+ if (!r)
+ {
+ *num = i;
+ break;
+ }
+ recs[i] = r;
}
- recs[i] = r;
}
#if USE_TIMING
yaz_timing_stop(t);
}
record = record_create(se->nmem,
- service->num_metadata, service->num_sortkeys, cl);
+ service->num_metadata, service->num_sortkeys, cl,
+ record_no);
mergekey_norm = (xmlChar *) nmem_strdup(se->nmem, (char*) mergekey);
xmlFree(mergekey);