/* This file is part of Pazpar2.
- Copyright (C) 2006-2009 Index Data
+ Copyright (C) 2006-2010 Index Data
Pazpar2 is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
#endif
if (lf && len)
{
- fwrite(result, 1, len, lf);
+ (void) fwrite(result, 1, len, lf);
fprintf(lf, "\n");
}
xmlFree(result);
}
struct record_cluster **show(struct session *s, struct reclist_sortparms *sp,
- int start, int *num, int *total, int *sumhits,
+ int start, int *num, int *total, Odr_int *sumhits,
NMEM nmem_show)
{
struct record_cluster **recs = nmem_malloc(nmem_show, *num
}
static struct record_metadata *record_metadata_init(
- NMEM nmem, const 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 = nmem_strdup(nmem, value);
pp2_relevance_token_t prt =
pp2_relevance_tokenize(
service->mergekey_pct,
- (const char *) value);
+ (const char *) value, 0);
+ if (wrbuf_len(norm_wr) > 0)
+ wrbuf_puts(norm_wr, " ");
wrbuf_puts(norm_wr, name);
- wrbuf_puts(norm_wr, "=");
while ((norm_str =
pp2_relevance_token_next(prt)))
{
if (*norm_str)
{
- if (wrbuf_len(norm_wr))
- wrbuf_puts(norm_wr, " ");
+ wrbuf_puts(norm_wr, " ");
wrbuf_puts(norm_wr, norm_str);
}
}
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, (const char *) value,
- ser_md->type);
+ ser_md->type, n->properties);
if (!rec_md)
{
yaz_log(YLOG_WARN, "bad metadata data '%s' for element '%s'",
// merged metadata
rec_md = record_metadata_init(se->nmem, (const char *) value,
- ser_md->type);
+ 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)