-/* $Id: zsets.c,v 1.103 2006-05-19 13:49:35 adam Exp $
+/* $Id: zsets.c,v 1.108 2006-06-22 15:07:20 adam Exp $
Copyright (C) 1995-2006
Index Data ApS
struct zebra_set_term_entry {
int reg_type;
char *db;
- int set;
- int use;
+ char *index_name;
char *term;
};
return res;
}
-void resultSetAddTerm (ZebraHandle zh, ZebraSet s, int reg_type,
- const char *db, int set,
- int use, const char *term)
+void resultSetAddTerm(ZebraHandle zh, ZebraSet s, int reg_type,
+ const char *db, const char *index_name,
+ const char *term)
{
assert(zh); /* compiler shut up */
if (!s->nmem)
{
s->term_entries[s->hits].reg_type = reg_type;
s->term_entries[s->hits].db = nmem_strdup (s->nmem, db);
- s->term_entries[s->hits].set = set;
- s->term_entries[s->hits].use = use;
- s->term_entries[s->hits].term = nmem_strdup (s->nmem, term);
+ s->term_entries[s->hits].index_name = nmem_strdup(s->nmem, index_name);
+ s->term_entries[s->hits].term = nmem_strdup(s->nmem, term);
}
(s->hits)++;
}
sortIdx_sysno (zh->reg->sortIdx, sysno);
for (i = 0; i<num_criteria; i++)
{
- sortIdx_type (zh->reg->sortIdx, criteria[i].ord);
- sortIdx_read (zh->reg->sortIdx, this_entry.buf[i]);
+ memset(this_entry.buf[i], '\0', SORT_IDX_ENTRYSIZE);
+ if (criteria[i].ord != -1)
+ {
+ sortIdx_type (zh->reg->sortIdx, criteria[i].ord);
+ sortIdx_read (zh->reg->sortIdx, this_entry.buf[i]);
+ }
}
i = sort_info->num_entries;
while (--i >= 0)
else
{
rel = memcmp (this_entry.buf[j], sort_info->entries[i]->buf[j],
- SORT_IDX_ENTRYSIZE);
+ SORT_IDX_ENTRYSIZE);
}
if (rel)
break;
{
Z_SortKeySpec *sks = sort_sequence->specs[i];
Z_SortKey *sk;
+ ZEBRA_RES res;
+
+ sort_criteria[i].ord = -1;
+ sort_criteria[i].numerical = 0;
+ if (sks->which == Z_SortKeySpec_missingValueData)
+ {
+ zebra_setError(zh, YAZ_BIB1_UNSUPP_MISSING_DATA_ACTION, 0);
+ return ZEBRA_FAIL;
+ }
if (*sks->sortRelation == Z_SortKeySpec_ascending)
sort_criteria[i].relation = 'A';
else if (*sks->sortRelation == Z_SortKeySpec_descending)
i+1);
sort_criteria[i].numerical = 0;
sort_criteria[i].ord =
- zebraExplain_lookup_attr_str(zh->reg->zei, 's',
+ zebraExplain_lookup_attr_str(zh->reg->zei,
+ zinfo_index_category_sort,
+ 's',
sk->u.sortField);
- if (sort_criteria[i].ord == -1)
+ if (sks->which != Z_SortKeySpec_null
+ && sort_criteria[i].ord == -1)
{
zebra_setError(zh,
YAZ_BIB1_CANNOT_SORT_ACCORDING_TO_SEQUENCE, 0);
return ZEBRA_FAIL;
case Z_SortKey_sortAttributes:
yaz_log(log_level_sort, "key %d is of type sortAttributes", i+1);
- if (zebra_sort_get_ord(zh, sk->u.sortAttributes,
- &sort_criteria[i].ord,
- &sort_criteria[i].numerical)
- != ZEBRA_OK)
+ 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;
}
{
RSFD rfd = rset_open(rset, RSETF_READ);
struct rank_control *rc = rank_class->control;
- double score;
+ int score;
zint count = 0;
void *handle =
NMEM nmem = nmem_create();
struct it_key key;
RSET rsets[2], rset_comb;
- RSET rset_temp = rstemp_create(nmem, kc, kc->scope,
- res_get (zh->res, "setTmpDir"),0 );
+ RSET rset_temp = rset_create_temp(nmem, kc, kc->scope,
+ res_get (zh->res, "setTmpDir"),0 );
TERMID termid;
RSFD rsfd = rset_open(rset_temp, RSETF_WRITE);
rsets[0] = rset_temp;
rsets[1] = rset_dup(sset->rset);
- rset_comb = rsmulti_and_create(nmem, kc, kc->scope, 2, rsets);
+ rset_comb = rset_create_and(nmem, kc, kc->scope, 2, rsets);
rsfd = rset_open(rset_comb, RSETF_READ);