-/* $Id: attribute.c,v 1.14 2002-08-02 19:26:55 adam Exp $
+/* $Id: attribute.c,v 1.15 2004-05-26 13:52:25 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
Index Data Aps
#include <zebrautl.h>
#include "index.h"
-static data1_att *getatt(data1_attset *p, int att)
+static data1_att *getatt(data1_attset *p, int att, const char *sattr)
{
data1_att *a;
data1_attset_child *c;
/* scan local set */
for (a = p->atts; a; a = a->next)
- if (a->value == att)
+ if (sattr && !yaz_matchstr(sattr, a->name))
+ return a;
+ else if (a->value == att)
return a;
/* scan included sets */
for (c = p->children; c; c = c->next)
- if ((a = getatt(c->child, att)))
+ if ((a = getatt(c->child, att, sattr)))
return a;
return 0;
}
-int att_getentbyatt(ZebraHandle zi, attent *res, oid_value set, int att)
+int att_getentbyatt(ZebraHandle zi, attent *res, oid_value set, int att,
+ const char *sattr)
{
data1_att *r;
data1_attset *p;
}
if (!p)
return -2;
- if (!(r = getatt(p, att)))
+ if (!(r = getatt(p, att, sattr)))
return -1;
res->attset_ordinal = r->parent->reference;
res->local_attributes = r->locals;
-/* $Id: index.h,v 1.105 2004-03-29 15:48:14 adam Exp $
+/* $Id: index.h,v 1.106 2004-05-26 13:52:25 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
ZebraRankClass zebraRankLookup (ZebraHandle zh, const char *name);
void zebraRankDestroy (struct zebra_register *reg);
-int att_getentbyatt(ZebraHandle zh, attent *res, oid_value set, int att);
+int att_getentbyatt(ZebraHandle zh, attent *res, oid_value set, int att,
+ const char *sattr);
extern struct rank_control *rank1_class;
extern struct rank_control *rankzv_class;
-/* $Id: zrpn.c,v 1.137 2004-05-10 08:47:54 adam Exp $
+/* $Id: zrpn.c,v 1.138 2004-05-26 13:52:26 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
zh->errString = basenames[base_no];
return -1;
}
- if (use_value == -2) /* string attribute (assume IDXPATH/any) */
+ if (xpath_use > 0 && use_value == -2)
{
use_value = xpath_use;
attp.local_attributes = &id_xpath_attr;
}
else
{
- if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value)))
+ if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value,
+ use_string)))
{
logf (LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d",
curAttributeSet, use_value, r);
if (r == -1)
{
/* set was found, but value wasn't defined */
- char val_str[32];
- sprintf (val_str, "%d 1", use_value);
errCode = 114;
- errString = nmem_strdup (stream, val_str);
+ if (use_string)
+ errString = nmem_strdup(stream, use_string);
+ else
+ {
+ char val_str[32];
+ sprintf (val_str, "%d", use_value);
+ errString = nmem_strdup (stream, val_str);
+ }
}
else
{
bases_ok++;
#else
char val_str[32];
- sprintf (val_str, "%d 2", use_value);
+ sprintf (val_str, "%d", use_value);
errCode = 114;
errString = nmem_strdup (stream, val_str);
#endif
}
else
{
- if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value)))
+ if ((r=att_getentbyatt (zh, &attp, curAttributeSet, use_value,
+ use_string)))
{
logf (LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d r=%d",
curAttributeSet, use_value, r);
char termz[IT_MAX_WORD+20];
AttrType use;
int use_value;
+ const char *use_string = 0;
struct scan_info *scan_info_array;
ZebraScanEntry *glist;
int ords[32], ord_no = 0;
pos, num, attributeset);
attr_init (&use, zapt, 1);
- use_value = attr_find (&use, &attributeset);
+ use_value = attr_find_ex (&use, &attributeset, &use_string);
if (zebra_maps_attr (zh->reg->zebra_maps, zapt, ®_id, &search_type,
rank_type, &complete_flag, &sort_flag))
attent attp;
data1_local_attribute *local_attr;
- if ((r=att_getentbyatt (zh, &attp, attributeset, use_value)))
+ if ((r=att_getentbyatt (zh, &attp, attributeset, use_value,
+ use_string)))
{
logf (LOG_DEBUG, "att_getentbyatt fail. set=%d use=%d",
attributeset, use_value);