/* This file is part of the Zebra server.
- Copyright (C) 1995-2008 Index Data
+ Copyright (C) 1994-2011 Index Data
Zebra is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
*/
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <assert.h>
#ifdef WIN32
rpn_get_top_approx_limit(zh, rpn->RPNStructure, &sset->approx_limit);
res = rpn_search_top(zh, rpn->RPNStructure, rpn->attributeSetId,
+ sset->approx_limit,
nmem, rset_nmem,
sort_sequence,
sset->num_bases, sset->basenames,
for (i = 0; sort_sequence->specs[i]; i++)
;
sort_sequence->num_specs = i;
- rset->hits_limit = sset->approx_limit;
+ rset_set_hits_limit(rset, sset->approx_limit);
+
if (!i)
{
res = resultSetRank(zh, sset, rset, rset_nmem);
criteria[i].ord[database_no]);
zebra_sort_type(zh->reg->sort_index, criteria[i].ord[database_no]);
wrbuf_rewind(w);
- if (zebra_sort_read(zh->reg->sort_index, w))
+ if (zebra_sort_read(zh->reg->sort_index, 0, w))
{
/* consider each sort entry and take lowest/highest one
of the one as sorting key depending on whether sort is
{
Z_SortKeySpec *sks = sort_sequence->specs[i];
Z_SortKey *sk;
- ZEBRA_RES res;
sort_criteria[i].ord = (int *)
nmem_malloc(nmem, sizeof(int)*numbases);
for (ib = 0; ib < numbases; ib++)
{
zebraExplain_curDatabase(zh->reg->zei, zh->basenames[ib]);
- res = zebra_sort_get_ord(zh, sk->u.sortAttributes,
- &sort_criteria[i].ord[ib],
- &sort_criteria[i].numerical[ib]);
+ if (zebra_sort_get_ord(zh, sk->u.sortAttributes,
+ &sort_criteria[i].ord[ib],
+ &sort_criteria[i].numerical[ib]) !=
+ ZEBRA_OK && sks->which != Z_SortKeySpec_null)
+ return ZEBRA_FAIL;
}
-
- if (sks->which != Z_SortKeySpec_null && res != ZEBRA_OK)
- return ZEBRA_FAIL;
break;
}
/* right now we look up the index type based on the first database
}
if (rfd->counted_items > rset->hits_limit)
stop_flag = 1;
+ if (stop_flag)
+ {
+ zebraSet->estimated_hit_count = 1;
+ break;
+ }
if (psysno)
{ /* only if we did have a previous record */
score = (*rc->calc)(handle, psysno, pstaticrank,
resultSetInsertRank(zh, sort_info, psysno, score, 'A');
count++;
}
- if (stop_flag)
- {
- zebraSet->estimated_hit_count = 1;
- rset_set_hits_limit(rset, 0);
- break;
- }
psysno = this_sys;
if (zh->m_staticrank)
pstaticrank = key.mem[0];
/*
* Local variables:
* c-basic-offset: 4
+ * c-file-style: "Stroustrup"
* indent-tabs-mode: nil
* End:
* vim: shiftwidth=4 tabstop=8 expandtab