-## $Id: Makefile.am,v 1.66 2007-11-23 13:59:14 adam Exp $
+## $Id: Makefile.am,v 1.67 2007-12-03 13:04:04 adam Exp $
aux_libs = \
../rset/libidzebra-rset.la \
rpnscan.c rpnsearch.c rpnfacet.c sortidx.c symtab.c stream.c \
update_path.c update_file.c trunc.c untrans.c isam_methods.c \
zaptterm.c zebraapi.c zinfo.c zinfo.h zsets.c key_block.c key_block.h \
- check_res.c
+ check_res.c rset_isam.c
bin_PROGRAMS = zebraidx zebrasrv
-/* $Id: index.h,v 1.211 2007-12-03 11:49:11 adam Exp $
+/* $Id: index.h,v 1.212 2007-12-03 13:04:04 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
void zebra_count_set(ZebraHandle zh, RSET rset, zint *count,
zint approx_limit);
+RSET zebra_create_rset_isam(ZebraHandle zh,
+ NMEM rset_nmem, struct rset_key_control *kctl,
+ int scope, ISAM_P pos, TERMID termid);
+
YAZ_END_CDECL
#endif
-/* $Id: retrieve.c,v 1.77 2007-12-03 11:49:11 adam Exp $
+/* $Id: retrieve.c,v 1.78 2007-12-03 13:04:04 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
RSET rsets[2], rset;
memcpy(&isam_p, info+1, sizeof(ISAM_P));
- rsets[0] = rsisamb_create(nmem, kc,
- 2, zh->reg->isamb, isam_p, 0);
+ rsets[0] = zebra_create_rset_isam(zh, nmem, kc, kc->scope, isam_p, 0);
rsets[1] = rset_dup(rset_set);
rset = rset_create_and(nmem, kc, kc->scope, 2, rsets);
*rec_bufp = odr_strdup(odr, wrbuf_cstr(wr));
wrbuf_destroy(wr);
*rec_lenp = strlen(*rec_bufp);
- *output_format = input_format;
+ *output_format = yaz_oid_recsyn_xml;
xfree(pos_array);
zebra_meta_records_destroy(zh, poset, num_recs);
-/* $Id: rpnsearch.c,v 1.24 2007-11-30 12:19:08 adam Exp $
+/* $Id: rpnsearch.c,v 1.25 2007-12-03 13:04:04 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
return ZEBRA_FAIL;
}
- if (!zh->reg->isamb && !zh->reg->isamc)
- {
- zebra_setError_zint(zh, YAZ_BIB1_UNSUPP_POSITION_ATTRIBUTE,
- position_value);
- return ZEBRA_FAIL;
- }
-
if (zebra_apt_get_ord(zh, zapt, index_type, 0,
attributeSet, &ord) != ZEBRA_OK)
{
{
assert(*val == sizeof(ISAM_P));
memcpy(&isam_p, val+1, sizeof(isam_p));
-
- if (zh->reg->isamb)
- *rset = rsisamb_create(rset_nmem, kc, kc->scope,
- zh->reg->isamb, isam_p, 0);
- else if (zh->reg->isamc)
- *rset = rsisamc_create(rset_nmem, kc, kc->scope,
- zh->reg->isamc, isam_p, 0);
+
+ *rset = zebra_create_rset_isam(zh, rset_nmem, kc, kc->scope,
+ isam_p, 0);
}
return ZEBRA_OK;
}
--- /dev/null
+/* $Id: rset_isam.c,v 1.1 2007-12-03 13:04:04 adam Exp $
+ Copyright (C) 1995-2007
+ Index Data ApS
+
+This file is part of the Zebra server.
+
+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
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+/** \file
+ \brief factory function for RSET from ISAM
+*/
+#include <stdio.h>
+#include <assert.h>
+
+#include "index.h"
+#include <rset.h>
+
+RSET zebra_create_rset_isam(ZebraHandle zh,
+ NMEM rset_nmem, struct rset_key_control *kctrl,
+ int scope, ISAM_P pos, TERMID termid)
+{
+ assert(zh);
+ assert(zh->reg);
+ if (zh->reg->isamb)
+ return rsisamb_create(rset_nmem, kctrl, scope,
+ zh->reg->isamb, pos, termid);
+ else if (zh->reg->isams)
+ return rsisams_create(rset_nmem, kctrl, scope,
+ zh->reg->isams, pos, termid);
+ else if (zh->reg->isamc)
+ return rsisamc_create(rset_nmem, kctrl, scope,
+ zh->reg->isamc, pos, termid);
+ else
+ return rset_create_null(rset_nmem, kctrl, termid);
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
-/* $Id: trunc.c,v 1.69 2007-10-29 16:57:53 adam Exp $
+/* $Id: trunc.c,v 1.70 2007-12-03 13:04:04 adam Exp $
Copyright (C) 1995-2007
Index Data ApS
return 0;
}
-RSET rset_trunc(ZebraHandle zi, ISAM_P *isam_p, int no,
+RSET rset_trunc(ZebraHandle zh, ISAM_P *isam_p, int no,
const char *term, int length, const char *flags,
int preserve_position, int term_type, NMEM rset_nmem,
struct rset_key_control *kctrl, int scope,
TERMID termid;
RSET result;
int trunc_chunk;
-
+ int trunc_limit = atoi(res_get_def(zh->res, "trunclimit", "10000"));
+
termid = rset_term_create(term, length, flags, term_type, rset_nmem, ol,
*index_type, hits_limit, term_ref_id);
+
if (no < 1)
return rset_create_null(rset_nmem, kctrl, termid);
-
- if (zi->reg->isams)
+ else if (no == 1)
+ return zebra_create_rset_isam(zh, rset_nmem, kctrl,
+ scope, *isam_p, termid);
+ else if (zh->reg->isamb && no > 1 && no < trunc_limit)
{
- if (no == 1)
- return rsisams_create(rset_nmem, kctrl, scope,
- zi->reg->isams, *isam_p, termid);
- qsort(isam_p, no, sizeof(*isam_p), isams_trunc_cmp);
- }
- else if (zi->reg->isamc)
- {
- if (no == 1)
- return rsisamc_create(rset_nmem, kctrl, scope,
- zi->reg->isamc, *isam_p, termid);
- qsort(isam_p, no, sizeof(*isam_p), isamc_trunc_cmp);
+ RSET r;
+ RSET *rsets = xmalloc(no*sizeof(RSET)); /* use nmem! */
+ int i;
+ for (i = 0; i<no; i++)
+ rsets[i] = rsisamb_create(rset_nmem, kctrl, scope,
+ zh->reg->isamb, isam_p[i],
+ 0 /* termid */);
+ r = rset_create_or(rset_nmem, kctrl, scope,
+ termid, no, rsets);
+ xfree(rsets);
+ return r;
}
- else if (zi->reg->isamb)
- {
- int trunc_limit = atoi(res_get_def(zi->res, "trunclimit", "10000"));
- if (no == 1)
- return rsisamb_create(rset_nmem, kctrl, scope,
- zi->reg->isamb, *isam_p, termid);
- else if (no < trunc_limit)
- {
- RSET r;
- RSET *rsets = xmalloc(no*sizeof(RSET)); /* use nmem! */
- int i;
- for (i = 0; i<no; i++)
- rsets[i] = rsisamb_create(rset_nmem, kctrl, scope,
- zi->reg->isamb, isam_p[i],
- 0 /* termid */);
- r = rset_create_or(rset_nmem, kctrl, scope,
- termid, no, rsets);
- xfree(rsets);
- return r;
- }
+ if (zh->reg->isamc)
qsort(isam_p, no, sizeof(*isam_p), isamc_trunc_cmp);
- }
else
- {
- yaz_log(YLOG_WARN, "Unknown isam set in rset_trunc");
- return rset_create_null(rset_nmem, kctrl, 0);
- }
- trunc_chunk = atoi(res_get_def(zi->res, "truncchunk", "20"));
- result = rset_trunc_r(zi, term, length, flags, isam_p, 0, no, trunc_chunk,
+ qsort(isam_p, no, sizeof(*isam_p), isams_trunc_cmp);
+ trunc_chunk = atoi(res_get_def(zh->res, "truncchunk", "20"));
+ result = rset_trunc_r(zh, term, length, flags, isam_p, 0, no, trunc_chunk,
preserve_position, term_type, rset_nmem, kctrl,
scope, termid);
return result;
# Zebra makefile for MS NMAKE
-# $Id: makefile,v 1.68 2007-11-23 14:00:16 adam Exp $
+# $Id: makefile,v 1.69 2007-12-03 13:04:04 adam Exp $
###########################################################
############### Parameters
$(OBJDIR)\rsbetween.obj \
$(OBJDIR)\rsbool.obj \
$(OBJDIR)\rset.obj \
+ $(OBJDIR)\rset_isam.obj \
$(OBJDIR)\rsisamb.obj \
$(OBJDIR)\rsisamc.obj \
$(OBJDIR)\rsisams.obj \