More work on sorting
[pazpar2-moved-to-github.git] / src / reclists.c
index 99c9c87..d063c17 100644 (file)
@@ -314,6 +314,16 @@ struct record_cluster *reclist_insert(struct reclist *l,
         if (!strcmp(merge_key, (*p)->record->merge_key))
         {
             struct record_cluster *existing = (*p)->record;
+            struct record *re = existing->records;
+
+            for (; re; re = re->next)
+            {
+                if (record_compare(record, re, service))
+                { 
+                    yaz_mutex_leave(l->mutex);
+                    return 0;
+                }
+            }
             record->next = existing->records;
             existing->records = record;
             cluster = existing;