-/* $Id: extract.c,v 1.182 2005-04-29 10:33:53 adam Exp $
+/* $Id: extract.c,v 1.183 2005-05-31 13:01:36 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
int attrSet, attrUse;
iscz1_decode(decode_handle, &dst, &src);
- assert(key.len < 4 && key.len > 2);
+ assert(key.len <= 4 && key.len > 2);
attrSet = (int) key.mem[0] >> 16;
attrUse = (int) key.mem[0] & 65535;
keys->buf_used = dst - keys->buf;
}
+void print_rec_keys(ZebraHandle zh, struct recKeys *reckeys)
+{
+ void *decode_handle = iscz1_start();
+ int off = 0;
+ int seqno = 0;
+ NMEM nmem = nmem_create();
+
+ yaz_log(YLOG_LOG, "print_rec_keys buf=%p sz=%d", reckeys->buf,
+ reckeys->buf_used);
+ assert(reckeys->buf);
+ while (off < reckeys->buf_used)
+ {
+ const char *src = reckeys->buf + off;
+ struct it_key key;
+ char *dst = (char*) &key;
+ int attrSet, attrUse;
+ char dst_buf[IT_MAX_WORD];
+ char *dst_term = dst_buf;
+
+ iscz1_decode(decode_handle, &dst, &src);
+ assert(key.len <= 4 && key.len > 2);
+
+ attrSet = (int) key.mem[0] >> 16;
+ attrUse = (int) key.mem[0] & 65535;
+ seqno = (int) key.mem[key.len-1];
+
+ zebra_term_untrans_iconv(zh, nmem, src[0], &dst_term, src+1);
+
+ yaz_log(YLOG_LOG, "ord=" ZINT_FORMAT " seqno=%d term=%s",
+ key.mem[0], seqno, dst_term);
+ while (*src++)
+ ;
+ off = src - reckeys->buf;
+ nmem_reset(nmem);
+ }
+ nmem_destroy(nmem);
+ iscz1_stop(decode_handle);
+}
+
void extract_add_index_string (RecWord *p, const char *str, int length)
{
struct it_key key;
-/* $Id: index.h,v 1.138 2005-05-11 12:39:36 adam Exp $
+/* $Id: index.h,v 1.139 2005-05-31 13:01:37 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
int zebra_record_int_read (void *fh, char *buf, size_t count);
void zebra_record_int_end (void *fh, off_t offset);
+void print_rec_keys(ZebraHandle zh, struct recKeys *reckeys);
+
void extract_flushRecordKeys (ZebraHandle zh, SYSNO sysno,
int cmd, struct recKeys *reckeys);
void extract_flushSortKeys (ZebraHandle zh, SYSNO sysno,
void zebra_setError(ZebraHandle zh, int code, const char *addinfo);
void zebra_setError_zint(ZebraHandle zh, int code, zint i);
+void zebra_term_untrans_iconv(ZebraHandle zh, NMEM stream, int reg_type,
+ char **dst, const char *src);
+
+ZEBRA_RES zebra_get_hit_vector(ZebraHandle zh, const char *setname, zint sysno);
+
YAZ_END_CDECL
#endif
-/* $Id: retrieve.c,v 1.29 2005-04-14 12:02:58 adam Exp $
+/* $Id: retrieve.c,v 1.30 2005-05-31 13:01:37 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
retrieveCtrl.res = zh->res;
retrieveCtrl.rec_buf = 0;
retrieveCtrl.rec_len = -1;
-
+
+ if (1)
+ {
+ struct recKeys reckeys;
+ reckeys.buf = rec->info[recInfo_delKeys];
+ reckeys.buf_used = rec->size[recInfo_delKeys];
+
+ print_rec_keys(zh, &reckeys);
+ }
(*rt->retrieve)(clientData, &retrieveCtrl);
*output_format = retrieveCtrl.output_format;
*rec_bufp = (char *) retrieveCtrl.rec_buf;
-/* $Id: zebraapi.c,v 1.170 2005-05-30 13:27:08 adam Exp $
+/* $Id: zebraapi.c,v 1.171 2005-05-31 13:01:37 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
{
char *buf;
int len;
+
+ zebra_get_hit_vector(zh, setname, poset[i].sysno);
+
recs[i].errCode =
zebra_record_fetch(zh, poset[i].sysno, poset[i].score,
stream, input_format, comp,
-/* $Id: zrpn.c,v 1.192 2005-05-24 11:35:42 adam Exp $
+/* $Id: zrpn.c,v 1.193 2005-05-31 13:01:37 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
ZebraSet termset;
};
-static void term_untrans(ZebraHandle zh, int reg_type,
- char *dst, const char *src)
+void zebra_term_untrans(ZebraHandle zh, int reg_type,
+ char *dst, const char *src)
{
int len = 0;
while (*src)
int su_code = 0;
int len = key_SU_decode (&su_code, name);
- term_untrans (p->zh, p->reg_type, term_tmp, name+len+1);
+ zebra_term_untrans (p->zh, p->reg_type, term_tmp, name+len+1);
yaz_log(log_level_rpn, "grep: %d %c %s", su_code, name[len], term_tmp);
zebraExplain_lookup_ord (p->zh->reg->zei,
su_code, &db, &set, &use);
return 0;
}
-static void scan_term_untrans (ZebraHandle zh, NMEM stream, int reg_type,
- char **dst, const char *src)
+void zebra_term_untrans_iconv(ZebraHandle zh, NMEM stream, int reg_type,
+ char **dst, const char *src)
{
char term_src[IT_MAX_WORD];
char term_dst[IT_MAX_WORD];
- term_untrans (zh, reg_type, term_src, src);
+ zebra_term_untrans (zh, reg_type, term_src, src);
if (zh->iconv_from_utf8 != 0)
{
if (lo >= 0)
{
/* get result set for first term */
- scan_term_untrans(zh, stream->mem, reg_id,
- &glist[lo].term, mterm);
+ zebra_term_untrans_iconv(zh, stream->mem, reg_id,
+ &glist[lo].term, mterm);
rset = rset_trunc(zh, &scan_info_array[j0].list[ptr[j0]].isam_p, 1,
glist[lo].term, strlen(glist[lo].term),
NULL, 0, zapt->term->which, rset_nmem,
if (j0 == -1)
break;
- scan_term_untrans (zh, stream->mem, reg_id,
- &glist[lo].term, mterm);
+ zebra_term_untrans_iconv(zh, stream->mem, reg_id,
+ &glist[lo].term, mterm);
rset = rset_trunc
(zh, &scan_info_array[j0].list[before-1-ptr[j0]].isam_p, 1,
glist[lo].term, strlen(glist[lo].term),
- NULL, 0, zapt->term->which,rset_nmem,
+ NULL, 0, zapt->term->which, rset_nmem,
kc, kc->scope);
ptr[j0]++;
-/* $Id: zsets.c,v 1.84 2005-05-31 07:29:10 adam Exp $
+/* $Id: zsets.c,v 1.85 2005-05-31 13:01:37 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
}
return ZEBRA_FAIL;
}
+
+ZEBRA_RES zebra_get_hit_vector(ZebraHandle zh, const char *setname,
+ zint sysno)
+{
+ ZebraSet sset = resultSetGet(zh, setname);
+ yaz_log(YLOG_LOG, "zebra_get_hit_vector setname=%s zysno=" ZINT_FORMAT,
+ setname, sysno);
+ if (!sset)
+ return ZEBRA_FAIL;
+ else
+ {
+ struct rset_key_control *kc = zebra_key_control_create(zh);
+ 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 );
+
+ TERMID termid;
+ RSFD rsfd = rset_open(rset_temp, RSETF_WRITE);
+
+ key.mem[0] = sysno;
+ key.mem[1] = 0;
+ key.mem[2] = 0;
+ key.mem[3] = 0;
+ key.len = 2;
+ rset_write (rsfd, &key);
+ rset_close (rsfd);
+
+ rsets[0] = rset_temp;
+ rsets[1] = rset_dup(sset->rset);
+
+ rset_comb = rsmulti_and_create(nmem, kc, kc->scope, 2, rsets);
+
+ rsfd = rset_open(rset_comb, RSETF_READ);
+
+ while (rset_read(rsfd, &key, &termid))
+ {
+ if (termid)
+ {
+ key_logdump_txt(YLOG_LOG, &key, termid->name);
+ yaz_log(YLOG_LOG, " type=%d", termid->type);
+ }
+ }
+ rset_close(rsfd);
+
+ rset_delete(rset_comb);
+ }
+ return ZEBRA_OK;
+}
+