/* This file is part of Pazpar2.
- Copyright (C) 2006-2013 Index Data
+ Copyright (C) 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
void reclist_enter(struct reclist *l)
{
yaz_mutex_enter(l->mutex);
- if (l)
- l->sorted_ptr = l->sorted_list;
+ l->sorted_ptr = l->sorted_list;
}
void reclist_leave(struct reclist *l)
{
yaz_mutex_leave(l->mutex);
- if (l)
- l->sorted_ptr = l->sorted_list;
+ l->sorted_ptr = l->sorted_list;
+}
+
+void reclist_rewind(struct reclist *l)
+{
+ l->sorted_ptr = l->sorted_list;
}
// We found a matching record. Merge them
if (!strcmp(merge_key, mkr->value))
{
- struct record **re;
-
rb = *p;
- for (re = &rb->record->records; *re; re = &(*re)->next)
+ if (!cluster)
{
- if ((*re)->client == record->client &&
- record_compare(record, *re, service))
+ struct record **re;
+ for (re = &rb->record->records; *re; re = &(*re)->next)
{
- yaz_mutex_leave(l->mutex);
- return 0;
+ if ((*re)->client == record->client &&
+ record_compare(record, *re, service))
+ {
+ yaz_mutex_leave(l->mutex);
+ return 0;
+ }
}
- }
-
- if (!cluster)
- {
cluster = rb->record;
*re = record;
record->next = 0;
- yaz_log(YLOG_LOG, "reclist: record insert %p", cluster);
}
else
{
if (cluster != rb->record)
{
assert(rb->record->relevance_explain1);
- yaz_log(YLOG_LOG, "reclist: cluster merge %p %p", cluster, rb->record);
merge_cluster(l, r, cluster, rb->record);
(*total)--;
}
{
(*total)++;
cluster = new_cluster(l, r, service, record, merge_keys);
- yaz_log(YLOG_LOG, "reclist: new cluster p=%p", cluster);
}
if (!rb)