- // Find out where we are putting it
- if (ser_md->merge == Metadata_merge_no)
- wheretoput = &record->metadata[md_field_id];
- else
- wheretoput = &cluster->metadata[md_field_id];
-
- // Put it there
-
-#if 1 //something wrong with constructor, debug tomorrow
- rec_md = nmem_malloc(se->nmem, sizeof(struct record_metadata));
- rec_md->next = 0;
-#else
- rec_md = record_metadata_create(se->nmem);
-#endif
-
- if (ser_md->type == Metadata_type_generic)
- {
- char *p, *pe;
- for (p = (char *) value; *p && isspace(*p); p++)
- ;
- for (pe = p + strlen(p) - 1;
- pe > p && strchr(" ,/.:([", *pe); pe--)
- *pe = '\0';
- rec_md->data.text = nmem_strdup(se->nmem, p);
-
- }
- else if (ser_md->type == Metadata_type_year)
- {
- if (extract_years((char *) value, &first, &last) < 0)
- continue;
- }
- else
- {
- yaz_log(YLOG_WARN,
- "Unknown type in metadata element %s", type);
- continue;
- }
- if (ser_md->type == Metadata_type_year
- && ser_md->merge != Metadata_merge_range)