From d8c3965cc2bb222a012481819c47db36a8a5905b Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 18 Dec 2013 10:10:35 +0100 Subject: [PATCH] Fix incorrect results for test_cluster_9 PAZ-911 The problem was that record where checked for comparison even though they shouldn't be - in case of cluster merge. --- src/reclists.c | 20 +++++++++----------- test/test_cluster_9.res | 17 ++++------------- 2 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/reclists.c b/src/reclists.c index f07a2cb..817c133 100644 --- a/src/reclists.c +++ b/src/reclists.c @@ -496,21 +496,19 @@ 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; diff --git a/test/test_cluster_9.res b/test/test_cluster_9.res index 0b6bbcc..d47758f 100644 --- a/test/test_cluster_9.res +++ b/test/test_cluster_9.res @@ -1,10 +1,10 @@ OK 0 -2 +1 4 0 -2 +1 Jack Collins book @@ -31,15 +31,6 @@ 1995 How to program a computer vol4 - 3 - 0 - content: author jack collins medium book title how to program a computer vol1 - - - Jack Collins - book - 1995 - How to program a computer vol3 Jack Collins @@ -54,8 +45,8 @@ 1995 How to program a computer vol4 - 2 + 5 0 - content: author jack collins medium book title how to program a computer vol3 + content: author jack collins medium book title how to program a computer vol1 \ No newline at end of file -- 1.7.10.4