X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Freclists.c;h=a04230aa4ed489986118a4d8be77bf327bc10c39;hb=40c4f55c2aa5ce6d912516b3030eb9f82b78b399;hp=1b431698021e5e6b31b4c47ca8257fb07c8295eb;hpb=fb19bc317370b4f4b508088b034b4c2d19257042;p=pazpar2-moved-to-github.git diff --git a/src/reclists.c b/src/reclists.c index 1b43169..a04230a 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -330,16 +330,19 @@ struct record_cluster *reclist_read_record(struct reclist *l) 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; } @@ -496,32 +499,28 @@ struct record_cluster *reclist_insert(struct reclist *l, // 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)--; } @@ -533,7 +532,6 @@ struct record_cluster *reclist_insert(struct reclist *l, { (*total)++; cluster = new_cluster(l, r, service, record, merge_keys); - yaz_log(YLOG_LOG, "reclist: new cluster p=%p", cluster); } if (!rb)