+For estimated hit counts, Zebra returns resultSetStatus=estimtate as
+part of SearchResponse. Requires YAZ 2.1.47 or later.
+
--- 2.0.8 2007/01/15
For searches, do not truncate more than at most 'truncmax' terms in one
dnl Zebra, Index Data ApS, 1995-2007
-dnl $Id: configure.ac,v 1.46 2007-01-15 20:14:37 adam Exp $
+dnl $Id: configure.ac,v 1.47 2007-01-16 15:01:15 adam Exp $
dnl
AC_PREREQ(2.59)
-AC_INIT([idzebra],[2.0.8],[zebra-help@indexdata.dk])
+AC_INIT([idzebra],[2.0.9],[zebra-help@indexdata.dk])
AC_CONFIG_SRCDIR(configure.ac)
AC_CONFIG_AUX_DIR(config)
AM_INIT_AUTOMAKE([1.8])
fi
dnl
dnl ------ YAZ
-YAZ_INIT($yazflag,2.1.45)
+YAZ_INIT($yazflag,2.1.47)
if test "$YAZVERSION" = "NONE"; then
AC_MSG_ERROR([YAZ development libraries required])
fi
-/* $Id: api.h,v 1.42 2007-01-15 20:08:24 adam Exp $
+/* $Id: api.h,v 1.43 2007-01-16 15:01:15 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
\param query RPN query using YAZ structure
\param setname name of resultset
\param hits number of hits is returned
+ \param estimated_hit_count whether hit count is an estimate
+ \param partial_resultset whether result is only partially evaluated
+*/
+YAZ_EXPORT
+ZEBRA_RES zebra_search_RPN_x(ZebraHandle zh, ODR o, Z_RPNQuery *query,
+ const char *setname, zint *hits,
+ int *estimated_hit_count,
+ int *partial_resultset);
+
+
+/** \brief Search using RPN Query structure (from ASN.1)
+ \param zh session handle
+ \param o ODR handle
+ \param query RPN query using YAZ structure
+ \param setname name of resultset
+ \param hits number of hits is returned
*/
YAZ_EXPORT
ZEBRA_RES zebra_search_RPN(ZebraHandle zh, ODR o, Z_RPNQuery *query,
-/* $Id: version.h,v 1.15 2007-01-15 20:14:38 adam Exp $
+/* $Id: version.h,v 1.16 2007-01-16 15:01:15 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
#ifndef ZEBRAVER
-#define ZEBRAVER "2.0.8"
+#define ZEBRAVER "2.0.9"
-#define ZEBRADATE "$Date: 2007-01-15 20:14:38 $"
+#define ZEBRADATE "$Date: 2007-01-16 15:01:15 $"
#endif
/*
-/* $Id: index.h,v 1.190 2007-01-15 20:08:25 adam Exp $
+/* $Id: index.h,v 1.191 2007-01-16 15:01:15 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
char *user_perm;
char *dbaccesslist;
int errCode;
- zint hits;
char *errString;
#if HAVE_SYS_TIMES_H
struct tms tms1;
ZebraSet resultSetAdd(ZebraHandle zh, const char *name, int ov);
ZebraSet resultSetGet(ZebraHandle zh, const char *name);
ZEBRA_RES resultSetAddRPN(ZebraHandle zh, NMEM m, Z_RPNQuery *rpn,
- int num_bases, char **basenames,
- const char *setname);
+ int num_bases, char **basenames,
+ const char *setname,
+ zint *hits, int *estimated_hit_count,
+ int *partial_resultset);
RSET resultSetRef(ZebraHandle zh, const char *resultSetId);
void resultSetDestroy(ZebraHandle zh, int num_names, char **names,
int *statuses);
-/* $Id: zebraapi.c,v 1.242 2007-01-15 15:10:17 adam Exp $
+/* $Id: zebraapi.c,v 1.243 2007-01-16 15:01:15 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
return ZEBRA_OK;
}
-ZEBRA_RES zebra_search_RPN(ZebraHandle zh, ODR o, Z_RPNQuery *query,
- const char *setname, zint *hits)
+ZEBRA_RES zebra_search_RPN_x(ZebraHandle zh, ODR o, Z_RPNQuery *query,
+ const char *setname, zint *hits,
+ int *estimated_hit_count,
+ int *partial_resultset)
{
ZEBRA_RES r;
assert(hits);
assert(setname);
yaz_log(log_level, "zebra_search_rpn");
- zh->hits = 0;
- *hits = 0;
if (zebra_begin_read(zh) == ZEBRA_FAIL)
return ZEBRA_FAIL;
r = resultSetAddRPN(zh, odr_extract_mem(o), query,
- zh->num_basenames, zh->basenames, setname);
+ zh->num_basenames, zh->basenames, setname,
+ hits, estimated_hit_count, partial_resultset);
zebra_end_read(zh);
- *hits = zh->hits;
return r;
}
+ZEBRA_RES zebra_search_RPN(ZebraHandle zh, ODR o, Z_RPNQuery *query,
+ const char *setname, zint *hits)
+{
+ int estimated_hit_count;
+ int partial_resultset;
+ return zebra_search_RPN_x(zh, o, query, setname, hits,
+ &estimated_hit_count,
+ &partial_resultset);
+}
+
ZEBRA_RES zebra_records_retrieve(ZebraHandle zh, ODR stream,
const char *setname,
Z_RecordComposition *comp,
Z_RPNQuery *query;
ODR odr;
+
ZEBRA_CHECK_HANDLE(zh);
odr = odr_createmem(ODR_ENCODE);
-/* $Id: zebrasrv.c,v 1.5 2007-01-15 15:10:17 adam Exp $
+/* $Id: zebrasrv.c,v 1.6 2007-01-16 15:01:15 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
switch (r->query->which)
{
case Z_Query_type_1: case Z_Query_type_101:
- res = zebra_search_RPN(zh, r->stream, r->query->u.type_1,
- r->setname, &zhits);
+ res = zebra_search_RPN_x(zh, r->stream, r->query->u.type_1,
+ r->setname, &zhits,
+ &r->estimated_hit_count,
+ &r->partial_resultset);
if (res != ZEBRA_OK)
zebra_result(zh, &r->errcode, &r->errstring);
else
-/* $Id: zsets.c,v 1.115 2007-01-15 15:10:17 adam Exp $
+/* $Id: zsets.c,v 1.116 2007-01-16 15:01:15 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
int term_entries_max;
struct zebra_set *next;
int locked;
+ int estimated_hit_count;
zint cache_position; /* last position */
RSFD cache_rfd; /* rfd (NULL if not existing) */
}
-ZEBRA_RES resultSetSearch(ZebraHandle zh, NMEM nmem, NMEM rset_nmem,
- Z_RPNQuery *rpn, ZebraSet sset)
+static ZEBRA_RES resultSetSearch(ZebraHandle zh, NMEM nmem, NMEM rset_nmem,
+ Z_RPNQuery *rpn, ZebraSet sset)
{
RSET rset = 0;
oident *attrset;
int sort_status, i;
ZEBRA_RES res = ZEBRA_OK;
- zh->hits = 0;
-
sort_sequence = (Z_SortKeySpecList *)
nmem_malloc(nmem, sizeof(*sort_sequence));
sort_sequence->num_specs = 10; /* FIXME - Hard-coded number */
ZEBRA_RES resultSetAddRPN (ZebraHandle zh, NMEM m, Z_RPNQuery *rpn,
int num_bases, char **basenames,
- const char *setname)
+ const char *setname,
+ zint *hits, int *estimated_hit_count,
+ int *partial_resultset)
{
ZebraSet zebraSet;
int i;
ZEBRA_RES res;
- zh->hits = 0;
+ *hits = 0;
+ *estimated_hit_count = 0;
+ *partial_resultset = 0;
zebraSet = resultSetAdd(zh, setname, 1);
if (!zebraSet)
res = resultSetSearch(zh, zebraSet->nmem, zebraSet->rset_nmem,
rpn, zebraSet);
- zh->hits = zebraSet->hits;
+ *hits = zebraSet->hits;
+ if (zebraSet->estimated_hit_count)
+ *estimated_hit_count = 1;
+
if (zebraSet->rset)
zebraSet->rpn = rpn;
zebraSet->locked = 0;
s->cache_position = 0;
s->cache_rfd = 0;
s->approx_limit = zh->approx_limit;
+ s->estimated_hit_count = 0;
return s;
}
sort_info = zebraSet->sort_info;
sort_info->num_entries = 0;
zebraSet->hits = 0;
+ zebraSet->estimated_hit_count = 0;
rset_getterms(rset, 0, 0, &n);
terms = (TERMID *) nmem_malloc(nmem, sizeof(*terms)*n);
rset_getterms(rset, terms, n, &numTerms);
if (this_sys != psysno)
{ /* new record .. */
if (rfd->counted_items > rset->hits_limit)
+ {
+ zebraSet->estimated_hit_count = 1;
break;
+ }
if (psysno)
{ /* only if we did have a previous record */
score = (*rc->calc) (handle, psysno, pstaticrank,