From b11b1ee307a9ebf51d3f9c8e33ca3a9438e7a932 Mon Sep 17 00:00:00 2001 From: Marc Cromme Date: Fri, 27 Apr 2007 10:27:35 +0000 Subject: [PATCH] in conf_metadata_assign() enforcing that merge_range is always type_year _and_ enforcing that type_year is always range_merge, thus setting contrains correctly at beginning of a server session setting processing. Removing these then unnecessary tests from ingest_record(), where there will produce warnings logs nobody can do anything about at that time, and where they are run for each ingested record. Less code, less performed if statements, no unnecessary warning logs. --- src/config.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/config.c b/src/config.c index dda9b3f..43dad51 100644 --- a/src/config.c +++ b/src/config.c @@ -1,4 +1,4 @@ -/* $Id: config.c,v 1.32 2007-04-27 09:38:13 marc Exp $ +/* $Id: config.c,v 1.33 2007-04-27 10:27:35 marc Exp $ Copyright (c) 2006-2007, Index Data. This file is part of Pazpar2. @@ -19,7 +19,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: config.c,v 1.32 2007-04-27 09:38:13 marc Exp $ */ +/* $Id: config.c,v 1.33 2007-04-27 10:27:35 marc Exp $ */ #include @@ -59,13 +59,18 @@ struct conf_metadata * conf_metadata_assign(NMEM nmem, return 0; metadata->name = nmem_strdup(nmem, name); - metadata->type = type; - // enforcing that years are always range merged + // enforcing that merge_range is always type_year + if (merge == Metadata_merge_range) + metadata->type = Metadata_type_year; + else + metadata->type = type; + + // enforcing that type_year is always range_merge if (metadata->type == Metadata_type_year) metadata->merge = Metadata_merge_range; else - metadata->merge = merge; + metadata->merge = merge; metadata->brief = brief; metadata->termlist = termlist; @@ -288,7 +293,8 @@ static struct conf_service *parse_service(xmlNode *node) type = Metadata_type_year; else { - yaz_log(YLOG_FATAL, "Unknown value for metadata/type: %s", xml_type); + yaz_log(YLOG_FATAL, + "Unknown value for metadata/type: %s", xml_type); return 0; } } -- 1.7.10.4