X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Flogic.c;h=92a0ecf8fc386c4efb004357add2a4834d60424f;hb=87ed6ffeb8473be66775b459235f3685967782c1;hp=afc84a9b14d44a6a7b83754de993de2ad5e23fb0;hpb=5fdac8e7a282d625568f5768bd3ae9367dd4acaf;p=pazpar2-moved-to-github.git diff --git a/src/logic.c b/src/logic.c index afc84a9..92a0ecf 100644 --- a/src/logic.c +++ b/src/logic.c @@ -1225,8 +1225,10 @@ struct record *ingest_record(struct client *cl, Z_External *rec, value, type); continue; } - rec_md->next = record->metadata[md_field_id]; - record->metadata[md_field_id] = rec_md; + wheretoput = &record->metadata[md_field_id]; + while (*wheretoput) + wheretoput = &(*wheretoput)->next; + *wheretoput = rec_md; // merged metadata rec_md = record_metadata_init(se->nmem, (char *) value, @@ -1235,6 +1237,12 @@ struct record *ingest_record(struct client *cl, Z_External *rec, // and polulate with data: // assign cluster or record based on merge action + if (ser_md->merge == Metadata_merge_no) + { + while (*wheretoput) + wheretoput = &(*wheretoput)->next; + *wheretoput = rec_md; + } if (ser_md->merge == Metadata_merge_unique) { struct record_metadata *mnode;