-/* $Id: attribute.c,v 1.27 2006-09-20 10:51:25 adam Exp $
- Copyright (C) 1995-2006
+/* $Id: attribute.c,v 1.33 2007-10-29 16:57:52 adam Exp $
+ Copyright (C) 1995-2007
Index Data ApS
This file is part of the Zebra server.
#include <idzebra/util.h>
#include <attrfind.h>
#include "index.h"
+#include <yaz/oid_db.h>
static data1_att *getatt(data1_attset *p, int att)
{
return 0;
}
-static int att_getentbyatt(ZebraHandle zi, oid_value set, int att,
+static int att_getentbyatt(ZebraHandle zi, const Odr_oid *set, int att,
const char **name)
{
data1_att *r;
ZEBRA_RES zebra_attr_list_get_ord(ZebraHandle zh,
Z_AttributeList *attr_list,
zinfo_index_category_t cat,
- int index_type,
- oid_value curAttributeSet,
+ const char *index_type,
+ const Odr_oid *curAttributeSet,
int *ord)
{
int use_value = -1;
}
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;
}
}
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,
- oid_value curAttributeSet,
+ const Odr_oid *curAttributeSet,
int *ord)
{
ZEBRA_RES res = ZEBRA_OK;
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);
}
{
AttrType structure;
int structure_value;
+
attr_init_AttrList(&structure, sortAttributes->list, 4);
*numerical = 0;
structure_value = attr_find(&structure, 0);
if (structure_value == 109)
*numerical = 1;
-
- if (zebra_attr_list_get_ord(zh, sortAttributes->list,
- zinfo_index_category_sort,
- -1 /* any index */, VAL_BIB1, ord)== ZEBRA_OK)
+
+ if (zebra_attr_list_get_ord(
+ zh, sortAttributes->list,
+ zinfo_index_category_sort,
+ 0 /* any index */, yaz_oid_attset_bib_1, ord) == ZEBRA_OK)
return ZEBRA_OK;
return ZEBRA_FAIL;
}