}
static struct record_metadata *record_metadata_init(
- NMEM nmem, char *value, enum conf_metadata_type type)
+ NMEM nmem, const char *value, enum conf_metadata_type type,
+ struct _xmlAttr *attr)
{
struct record_metadata *rec_md = record_metadata_create(nmem);
+ struct record_metadata_attr **attrp = &rec_md->attributes;
+
+ for (; attr; attr = attr->next)
+ {
+ if (attr->children && attr->children->content)
+ {
+ if (strcmp((const char *) attr->name, "type"))
+ { /* skip the "type" attribute.. Its value is already part of
+ the element in output (md-%s) and so repeating it here
+ is redundant */
+ *attrp = nmem_malloc(nmem, sizeof(**attrp));
+ (*attrp)->name =
+ nmem_strdup(nmem, (const char *) attr->name);
+ (*attrp)->value =
+ nmem_strdup(nmem, (const char *) attr->children->content);
+ attrp = &(*attrp)->next;
+ }
+ }
+ }
+ *attrp = 0;
+
if (type == Metadata_type_generic)
{
- char * p = value;
+ char *p = nmem_strdup(nmem, value);
+
p = normalize7bit_generic(p, " ,/.:([");
- rec_md->data.text.disp = nmem_strdup(nmem, p);
+ rec_md->data.text.disp = p;
rec_md->data.text.sort = 0;
}
else if (type == Metadata_type_year || type == Metadata_type_date)
pp2_relevance_token_t prt =
pp2_relevance_tokenize(
service->mergekey_pct,
- (const char *) value);
+ (const char *) value, 0);
wrbuf_puts(norm_wr, name);
wrbuf_puts(norm_wr, "=");
pp2_relevance_token_t prt =
pp2_relevance_tokenize(
service->mergekey_pct,
- (const char *) mergekey);
+ (const char *) mergekey, 0);
while ((norm_str = pp2_relevance_token_next(prt)))
{
}
// non-merged metadata
- rec_md = record_metadata_init(se->nmem, (char *) value,
- ser_md->type);
+ rec_md = record_metadata_init(se->nmem, (const char *) value,
+ ser_md->type, n->properties);
if (!rec_md)
{
yaz_log(YLOG_WARN, "bad metadata data '%s' for element '%s'",
*wheretoput = rec_md;
// merged metadata
- rec_md = record_metadata_init(se->nmem, (char *) value,
- ser_md->type);
+ rec_md = record_metadata_init(se->nmem, (const char *) value,
+ ser_md->type, 0);
wheretoput = &cluster->metadata[md_field_id];
// and polulate with data:
prt = pp2_relevance_tokenize(
service->sort_pct,
- rec_md->data.text.disp);
+ rec_md->data.text.disp, skip_article);
pp2_relevance_token_next(prt);
- sort_str = pp2_get_sort(prt, skip_article);
+ sort_str = pp2_get_sort(prt);
cluster->sortkeys[sk_field_id]->text.disp =
rec_md->data.text.disp;
// ranking of _all_ fields enabled ...
if (ser_md->rank)
relevance_countwords(se->relevance, cluster,
- (char *) value, ser_md->rank);
+ (char *) value, ser_md->rank,
+ ser_md->name);
// construct facets ...
if (ser_md->termlist)