X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=blobdiff_plain;f=index%2Fattribute.c;h=d0f0a6a62b4413c1e07d96df71babf98e1f3b68c;hp=e37e3a0b8e35b6279c8f5a283b8e4146a4408cb7;hb=89d16cf15eda0e4802d18b8ad09bd3653508ebfc;hpb=1b5ef8265837240930862dddd2d7ef963a0cc211 diff --git a/index/attribute.c b/index/attribute.c index e37e3a0..d0f0a6a 100644 --- a/index/attribute.c +++ b/index/attribute.c @@ -1,8 +1,5 @@ -/* $Id: attribute.c,v 1.30 2007-04-16 21:54:37 adam Exp $ - Copyright (C) 1995-2007 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 1994-2009 Index Data Zebra 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 @@ -46,7 +43,7 @@ static data1_att *getatt(data1_attset *p, int att) return 0; } -static int att_getentbyatt(ZebraHandle zi, const int *set, int att, +static int att_getentbyatt(ZebraHandle zi, const Odr_oid *set, int att, const char **name) { data1_att *r; @@ -69,8 +66,8 @@ static int att_getentbyatt(ZebraHandle zi, const int *set, int att, ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh, Z_AttributeList *attr_list, zinfo_index_category_t cat, - int index_type, - const int *curAttributeSet, + const char *index_type, + const Odr_oid *curAttributeSet, int *ord) { int use_value = -1; @@ -98,7 +95,7 @@ ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh, } if (r == -1) { - zebra_setError_zint(zh, YAZ_BIB1_UNSUPP_USE_ATTRIBUTE, use_value); + zebra_setError_zint(zh, YAZ_BIB1_UNSUPP_USE_ATTRIBUTE, use_value); return ZEBRA_FAIL; } } @@ -111,20 +108,32 @@ ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh, index_type, use_string); if (*ord == -1) { - if (use_value < 0) - zebra_setError(zh, YAZ_BIB1_UNSUPP_USE_ATTRIBUTE, use_string); - else - zebra_setError_zint(zh, YAZ_BIB1_UNSUPP_USE_ATTRIBUTE, use_value); - return ZEBRA_FAIL; + /* attribute 14=1 does not issue a diagnostic even + 1) the attribute is numeric but listed in .att + 2) the use attribute is string + */ + AttrType unsup; + int unsup_value = 0; + attr_init_AttrList(&unsup, attr_list, 14); + unsup_value = attr_find(&unsup, 0); + + if (unsup_value != 1) + { + if (use_value < 0) + zebra_setError(zh, YAZ_BIB1_UNSUPP_USE_ATTRIBUTE, use_string); + else + zebra_setError_zint(zh, YAZ_BIB1_UNSUPP_USE_ATTRIBUTE, use_value); + return ZEBRA_FAIL; + } } return ZEBRA_OK; } ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh, Z_AttributesPlusTerm *zapt, - int index_type, + const char *index_type, const char *xpath_use, - const int *curAttributeSet, + const Odr_oid *curAttributeSet, int *ord) { ZEBRA_RES res = ZEBRA_OK; @@ -160,14 +169,14 @@ ZEBRA_RES zebra_apt_get_ord(ZebraHandle zh, xpath_use); if (*ord == -1) { - yaz_log(YLOG_LOG, "zebra_apt_get_ord FAILED xpath=%s index_type=%c", + yaz_log(YLOG_LOG, "zebra_apt_get_ord FAILED xpath=%s index_type=%s", xpath_use, index_type); zebra_setError(zh, YAZ_BIB1_UNSUPP_USE_ATTRIBUTE, 0); res = ZEBRA_FAIL; } else { - yaz_log(YLOG_LOG, "zebra_apt_get_ord OK xpath=%s index_type=%c", + yaz_log(YLOG_LOG, "zebra_apt_get_ord OK xpath=%s index_type=%s", xpath_use, index_type); } @@ -193,7 +202,7 @@ ZEBRA_RES zebra_sort_get_ord(ZebraHandle zh, if (zebra_attr_list_get_ord( zh, sortAttributes->list, zinfo_index_category_sort, - -1 /* any index */, yaz_oid_attset_bib_1, ord) == ZEBRA_OK) + 0 /* any index */, yaz_oid_attset_bib_1, ord) == ZEBRA_OK) return ZEBRA_OK; return ZEBRA_FAIL; }