/* This file is part of Pazpar2.
- Copyright (C) 2006-2012 Index Data
+ Copyright (C) 2006-2013 Index Data
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
return res;
}
-void reclist_limit(struct reclist *l, struct session *se)
+void reclist_limit(struct reclist *l, struct session *se, int lazy)
{
unsigned i;
int num = 0;
struct reclist_bucket **pp = &l->sorted_list;
reclist_enter(l);
- for (i = 0; i < l->hash_size; i++)
+
+ if (!lazy || !*pp)
{
- struct reclist_bucket *p;
- for (p = l->hashtable[i]; p; p = p->hash_next)
+ for (i = 0; i < l->hash_size; i++)
{
- if (session_check_cluster_limit(se, p->record))
- {
- *pp = p;
- pp = &p->sorted_next;
- num++;
- }
- else
+ struct reclist_bucket *p;
+ for (p = l->hashtable[i]; p; p = p->hash_next)
{
- yaz_log(YLOG_LOG, "session_check_cluster returned false");
+ if (session_check_cluster_limit(se, p->record))
+ {
+ *pp = p;
+ pp = &p->sorted_next;
+ num++;
+ }
}
}
+ *pp = 0;
}
- *pp = 0;
l->num_records = num;
reclist_leave(l);
}
cluster->relevance_explain2 = wrbuf_alloc();
/* attach to hash list */
*p = new;
+ l->num_records++;
}
yaz_mutex_leave(l->mutex);
return cluster;