if (block)
{
- if (status && (!s->psession->reclist || !s->psession->reclist->num_records))
+ if (status && reclist_get_num_records(s->psession->reclist) == 0)
{
// if there is already a watch/block. we do not block this one
if (session_set_watch(s->psession, SESSION_WATCH_SHOW,
}
reclist_sort(s->reclist, sp);
- *total = s->reclist->num_records;
+ *total = reclist_get_num_records(s->reclist);
*sumhits = s->total_hits;
for (i = 0; i < start; i++)
#include "reclists.h"
#include "jenkins_hash.h"
+struct reclist
+{
+ struct reclist_bucket **hashtable;
+ int hashtable_size;
+ int hashmask;
+
+ struct record_cluster **flatlist;
+ int flatlist_size;
+ int num_records;
+ int pointer;
+
+ NMEM nmem;
+};
+
static struct reclist_sortparms *qsort_sortparms = 0; /* thread pr */
struct reclist_bucket
return res;
}
+int reclist_get_num_records(struct reclist *l)
+{
+ if (l)
+ return l->num_records;
+ return 0;
+}
+
+struct record_cluster *reclist_get_cluster(struct reclist *l, int i)
+{
+ return l->flatlist[i];
+}
+
// Insert a record. Return record cluster (newly formed or pre-existing)
struct record_cluster *reclist_insert( struct reclist *l,
struct conf_service *service,
#include "pazpar2_config.h"
#include "record.h"
-struct reclist
-{
- struct reclist_bucket **hashtable;
- int hashtable_size;
- int hashmask;
-
- struct record_cluster **flatlist;
- int flatlist_size;
- int num_records;
- int pointer;
-
- NMEM nmem;
-};
+struct reclist;
// This is a recipe for sorting. First node in list has highest priority
struct reclist_sortparms
struct reclist_sortparms *reclist_parse_sortparms(NMEM nmem, const char *parms,
struct conf_service *service);
+int reclist_get_num_records(struct reclist *l);
+struct record_cluster *reclist_get_cluster(struct reclist *l, int i);
+
#endif
/*
}
}
// Calculate relevance for each document
- for (i = 0; i < reclist->num_records; i++)
+ for (i = 0; i < reclist_get_num_records(reclist); i++)
{
int t;
- struct record_cluster *rec = reclist->flatlist[i];
+ struct record_cluster *rec = reclist_get_cluster(reclist, i);
float relevance;
relevance = 0;
for (t = 1; t < rel->vec_len; t++)
}
rec->relevance = (int) (relevance * 100000);
}
- reclist->pointer = 0;
+ reclist_rewind(reclist);
xfree(idfvec);
}