-/* $Id: zsets.c,v 1.99 2006-01-26 22:17:16 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: zsets.c,v 1.102 2006-05-18 12:03:05 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.
#endif
#include "index.h"
+#include "rank.h"
#include <yaz/diagbib1.h>
#include <rset.h>
struct sortKeyInfo {
int relation;
+#if 0
int attrUse;
+#else
+ int ord;
+#endif
int numerical;
};
sortIdx_sysno (zh->reg->sortIdx, sysno);
for (i = 0; i<num_criteria; i++)
{
- sortIdx_type (zh->reg->sortIdx, criteria[i].attrUse);
+ sortIdx_type (zh->reg->sortIdx, criteria[i].ord);
sortIdx_read (zh->reg->sortIdx, this_entry.buf[i]);
}
i = sort_info->num_entries;
return ZEBRA_FAIL;
case Z_SortKey_sortAttributes:
yaz_log(log_level_sort, "key %d is of type sortAttributes", i+1);
- sort_criteria[i].attrUse =
- zebra_maps_sort (zh->reg->zebra_maps,
- sk->u.sortAttributes,
- &sort_criteria[i].numerical);
- yaz_log(log_level_sort, "use value = %d", sort_criteria[i].attrUse);
- if (sort_criteria[i].attrUse == -1)
- {
- zebra_setError(
- zh, YAZ_BIB1_USE_ATTRIBUTE_REQUIRED_BUT_NOT_SUPPLIED, 0);
- return ZEBRA_FAIL;
- }
- if (sortIdx_type (zh->reg->sortIdx, sort_criteria[i].attrUse))
+ if (1)
{
- zebra_setError(
- zh, YAZ_BIB1_CANNOT_SORT_ACCORDING_TO_SEQUENCE, 0);
- return ZEBRA_FAIL;
+ int ord;
+ int use = zebra_maps_sort(zh->reg->zebra_maps,
+ sk->u.sortAttributes,
+ &sort_criteria[i].numerical);
+ yaz_log(log_level_sort, "use value = %d", use);
+ if (use == -1)
+ {
+ zebra_setError(
+ zh, YAZ_BIB1_USE_ATTRIBUTE_REQUIRED_BUT_NOT_SUPPLIED, 0);
+ return ZEBRA_FAIL;
+ }
+ ord = zebraExplain_lookup_attr_su_any_index(zh->reg->zei,
+ VAL_IDXPATH, use);
+ if (ord == -1)
+ {
+ zebra_setError(
+ zh, YAZ_BIB1_CANNOT_SORT_ACCORDING_TO_SEQUENCE, 0);
+ return ZEBRA_FAIL;
+ }
+ sort_criteria[i].ord = ord;
}
break;
}
return ZEBRA_OK;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+