X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fpazpar2.c;h=c24ec00ec07bc45b8036f91ceace1641cdc209c0;hb=82b7dfb4f633ed64ddb402d3cd81d391e6a936bc;hp=3805d88ee6ddb6400c0edf1d92c66ad3c318b62e;hpb=8ca1269eac32c1ddc19d16dc4f74e9a1e3e0b8f9;p=pazpar2-moved-to-github.git diff --git a/src/pazpar2.c b/src/pazpar2.c index 3805d88..c24ec00 100644 --- a/src/pazpar2.c +++ b/src/pazpar2.c @@ -1,4 +1,4 @@ -/* $Id: pazpar2.c,v 1.30 2007-01-15 04:34:28 quinn Exp $ */ +/* $Id: pazpar2.c,v 1.34 2007-01-15 20:01:53 quinn Exp $ */ #include #include @@ -319,7 +319,10 @@ char *normalize_mergekey(char *buf, int skiparticle) p++; } if (buf != pout) - *pout = '\0'; + do { + *(pout--) = '\0'; + } + while (pout > buf && *pout == ' '); return buf; } @@ -364,6 +367,8 @@ static void add_facet(struct session *s, const char *type, const char *value) { int i; + if (!*value) + return; for (i = 0; i < s->num_termlists; i++) if (!strcmp(s->termlists[i].name, type)) break; @@ -510,6 +515,7 @@ static struct record *ingest_record(struct client *cl, Z_External *rec) mergekey_norm = nmem_strdup(se->nmem, (char*) mergekey); xmlFree(mergekey); normalize_mergekey(mergekey_norm, 0); + yaz_log(YLOG_LOG, "MK: '%s'", mergekey_norm); cluster = reclist_insert(se->reclist, res, mergekey_norm, &se->total_merged); if (!cluster) @@ -567,7 +573,12 @@ static struct record *ingest_record(struct client *cl, Z_External *rec) newm->next = 0; if (md->type == Metadata_type_generic) { + char *p; newm->data.text = nmem_strdup(se->nmem, value); + for (p = newm->data.text + strlen(newm->data.text) - 1; + p > newm->data.text && strchr(" ,/.", *p); p--) + *p = '\0'; + } else if (md->type == Metadata_type_year) { @@ -611,7 +622,6 @@ static struct record *ingest_record(struct client *cl, Z_External *rec) normalize_mergekey(s, (sk->type == Metadata_sortkey_skiparticle)); cluster->sortkeys[md->sortkey_offset]->text = s; - yaz_log(YLOG_LOG, "SK Longest: %s", s); } } } @@ -644,11 +654,13 @@ static struct record *ingest_record(struct client *cl, Z_External *rec) sdata->number.max = last; } } +#ifdef GAGA if (sk) { union data_types *sdata = cluster->sortkeys[md->sortkey_offset]; yaz_log(YLOG_LOG, "SK range: %d-%d", sdata->number.min, sdata->number.max); } +#endif } else yaz_log(YLOG_WARN, "Don't know how to merge on element name %s", md->name);