X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzsets.c;h=65e527268aeb69f16e0ec3f37a76035c019bbe44;hb=f7a3769dede0071696bdcc13ae2ee1efe6d52d96;hp=2c543df325b4738e209e89dbf7e94d0340ffa2d9;hpb=6b1dece7410af50ba077381066c10c44f0188868;p=idzebra-moved-to-github.git diff --git a/index/zsets.c b/index/zsets.c index 2c543df..65e5272 100644 --- a/index/zsets.c +++ b/index/zsets.c @@ -1,5 +1,5 @@ -/* $Id: zsets.c,v 1.98 2006-01-19 13:31:08 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. @@ -30,6 +30,7 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #endif #include "index.h" +#include "rank.h" #include #include @@ -268,6 +269,7 @@ ZebraSet resultSetAdd(ZebraHandle zh, const char *name, int ov) s->rset_nmem = 0; s->nmem = 0; s->rpn = 0; + s->sortSpec = 0; s->cache_position = 0; s->cache_rfd = 0; s->approx_limit = zh->approx_limit; @@ -536,7 +538,11 @@ void zebra_meta_records_destroy (ZebraHandle zh, ZebraMetaRecord *records, struct sortKeyInfo { int relation; +#if 0 int attrUse; +#else + int ord; +#endif int numerical; }; @@ -552,7 +558,7 @@ void resultSetInsertSort (ZebraHandle zh, ZebraSet sset, sortIdx_sysno (zh->reg->sortIdx, sysno); for (i = 0; ireg->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; @@ -847,22 +853,28 @@ ZEBRA_RES resultSetSortSingle(ZebraHandle zh, NMEM nmem, 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; } @@ -1200,3 +1212,11 @@ ZEBRA_RES zebra_snippets_hit_vector(ZebraHandle zh, const char *setname, return ZEBRA_OK; } +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +