-/* $Id: attribute.c,v 1.26 2006-08-14 10:40:15 adam Exp $
+/* $Id: attribute.c,v 1.27 2006-09-20 10:51:25 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
if (zebra_attr_list_get_ord(zh, sortAttributes->list,
zinfo_index_category_sort,
- 's', VAL_BIB1, ord)== ZEBRA_OK)
- return ZEBRA_OK;
- if (zebra_attr_list_get_ord(zh, sortAttributes->list,
- zinfo_index_category_sort,
- 'S', VAL_BIB1, ord)== ZEBRA_OK)
+ -1 /* any index */, VAL_BIB1, ord)== ZEBRA_OK)
return ZEBRA_OK;
return ZEBRA_FAIL;
}
-/* $Id: zinfo.c,v 1.69 2006-09-15 10:45:13 adam Exp $
+/* $Id: zinfo.c,v 1.70 2006-09-20 10:51:25 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
assert (zei->curDatabaseInfo);
for (zsui = &zei->curDatabaseInfo->attributeDetails->SUInfo;
*zsui; zsui = &(*zsui)->next)
- if ((*zsui)->info.index_type == index_type
- && (*zsui)->info.cat == cat
- && (*zsui)->info.which == ZEB_SU_STR
- && !yaz_matchstr((*zsui)->info.u.str, str))
+ if ( (index_type == -1 || (*zsui)->info.index_type == index_type)
+ && (*zsui)->info.cat == cat
+ && (*zsui)->info.which == ZEB_SU_STR
+ && !yaz_matchstr((*zsui)->info.u.str, str))
{
struct zebSUInfoB *zsui_this = *zsui;
-/* $Id: zsets.c,v 1.110 2006-08-14 10:40:15 adam Exp $
+/* $Id: zsets.c,v 1.111 2006-09-20 10:51:25 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
struct sortKeyInfo {
int relation;
-#if 0
- int attrUse;
-#else
int ord;
-#endif
int numerical;
+ int index_type;
};
void resultSetInsertSort(ZebraHandle zh, ZebraSet sset,
cmp_buf[j] + i * SORT_IDX_ENTRYSIZE;
if (criteria[j].numerical)
{
- double diff = atof(this_entry_buf) - atof(other_entry_buf);
- rel = 0;
+ char this_entry_org[1024];
+ char other_entry_org[1024];
+ double diff;
+ int index_type = criteria[j].index_type;
+ zebra_term_untrans(zh, index_type, this_entry_org,
+ this_entry_buf);
+ zebra_term_untrans(zh, index_type, other_entry_org,
+ other_entry_buf);
+ diff = atof(this_entry_org) - atof(other_entry_org);
+
if (diff > 0.0)
rel = 1;
else if (diff < 0.0)
rel = -1;
+ else
+ rel = 0;
}
else
{
sort_criteria[i].ord =
zebraExplain_lookup_attr_str(zh->reg->zei,
zinfo_index_category_sort,
- 's',
- sk->u.sortField);
+ -1, sk->u.sortField);
if (sks->which != Z_SortKeySpec_null
&& sort_criteria[i].ord == -1)
{
case Z_SortKey_sortAttributes:
yaz_log(log_level_sort, "key %d is of type sortAttributes", i+1);
res = zebra_sort_get_ord(zh, sk->u.sortAttributes,
+
&sort_criteria[i].ord,
&sort_criteria[i].numerical);
if (sks->which != Z_SortKeySpec_null && res != ZEBRA_OK)
return ZEBRA_FAIL;
break;
}
+ if (zebraExplain_lookup_ord(zh->reg->zei, sort_criteria[i].ord,
+ &sort_criteria[i].index_type,
+ 0, 0))
+ {
+ zebra_setError(zh, YAZ_BIB1_CANNOT_SORT_ACCORDING_TO_SEQUENCE, 0);
+ return ZEBRA_FAIL;
+ }
}
/* allocate space for each cmpare buf + one extra for tmp comparison */
for (i = 0; i<num_criteria; i++)
# Zebra indexes as referred to from the *.abs-files.
-# $Id: default.idx,v 1.3 2005-05-04 10:50:09 adam Exp $
+# $Id: default.idx,v 1.4 2006-09-20 10:51:25 adam Exp $
#
# Traditional word index
# Sort register with no map
sort S
completeness 1
-charmap @
+charmap string.chr
-/* $Id: sort1.c,v 1.10 2006-08-14 10:40:30 adam Exp $
+/* $Id: sort1.c,v 1.11 2006-09-20 10:51:25 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
ids[2] = 4;
ids[3] = 5;
YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=30 0", 4, ids));
+ YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Date 0", 4, ids));
ids[0] = 5;
ids[1] = 4;
ids[2] = 2;
ids[3] = 3;
YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=1021 0", 4, ids));
+ YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Bib-Level 0", 4, ids));
ids[0] = 2;
ids[1] = 5;
ids[2] = 4;
ids[3] = 3;
YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=1021 @attr 4=109 0", 4, ids));
+ YAZ_CHECK(tl_sort(zh, "@or @attr 1=4 computer @attr 7=1 @attr 1=Bib-Level @attr 4=109 0", 4, ids));
YAZ_CHECK(tl_close_down(zh, zs));
}