From: Adam Dickmeiss Date: Mon, 22 Sep 1997 12:39:06 +0000 (+0000) Subject: Added get_pos method for the ranked result sets. X-Git-Tag: ZEBRA.1.0~313 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=b0728a451f81973f750f6a806b566d506a17dbe9;p=idzebra-moved-to-github.git Added get_pos method for the ranked result sets. --- diff --git a/include/rsrel.h b/include/rsrel.h index 8188a5f..08d01f3 100644 --- a/include/rsrel.h +++ b/include/rsrel.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: rsrel.h,v $ - * Revision 1.4 1997-09-05 15:30:05 adam + * Revision 1.5 1997-09-22 12:39:06 adam + * Added get_pos method for the ranked result sets. + * + * Revision 1.4 1997/09/05 15:30:05 adam * Changed prototype for chr_map_input - added const. * Added support for C++, headers uses extern "C" for public definitions. * @@ -41,8 +44,9 @@ typedef struct rset_relevance_parms ISAM_P *isam_positions; int no_isam_positions; - int no_terms; - int *term_no; + int no_terms; + int *term_no; + int (*get_pos)(const void *p); } rset_relevance_parms; #ifdef __cplusplus diff --git a/index/index.h b/index/index.h index 2ae3ab2..ebbbeb2 100644 --- a/index/index.h +++ b/index/index.h @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: index.h,v $ - * Revision 1.51 1997-09-18 08:59:19 adam + * Revision 1.52 1997-09-22 12:39:06 adam + * Added get_pos method for the ranked result sets. + * + * Revision 1.51 1997/09/18 08:59:19 adam * Extra generic handle for the character mapping routines. * * Revision 1.50 1997/09/17 12:19:13 adam @@ -256,6 +259,7 @@ void repositoryShow (struct recordGroup *rGroup); void key_open (BFiles bfs, int mem); int key_close (void); int key_compare (const void *p1, const void *p2); +int key_get_pos (const void *p); int key_compare_it (const void *p1, const void *p2); int key_qsort_compare (const void *p1, const void *p2); void key_logdump (int mask, const void *p); diff --git a/index/kcompare.c b/index/kcompare.c index 849d8fa..ca513ab 100644 --- a/index/kcompare.c +++ b/index/kcompare.c @@ -1,10 +1,13 @@ /* - * Copyright (C) 1994-1996, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: kcompare.c,v $ - * Revision 1.21 1997-09-17 12:19:13 adam + * Revision 1.22 1997-09-22 12:39:06 adam + * Added get_pos method for the ranked result sets. + * + * Revision 1.21 1997/09/17 12:19:13 adam * Zebra version corresponds to YAZ version 1.4. * Changed Zebra server so that it doesn't depend on global common_resource. * @@ -149,6 +152,13 @@ int key_qsort_compare (const void *p1, const void *p2) return cp1[l] - cp2[l]; } +int key_get_pos (const void *p) +{ + struct it_key key; + memcpy (&key, p, sizeof(key)); + return key.seqno; +} + struct iscz1_code_info { struct it_key key; }; diff --git a/index/trunc.c b/index/trunc.c index 3212c6d..531a9c6 100644 --- a/index/trunc.c +++ b/index/trunc.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: trunc.c,v $ - * Revision 1.5 1997-09-17 12:19:17 adam + * Revision 1.6 1997-09-22 12:39:06 adam + * Added get_pos method for the ranked result sets. + * + * Revision 1.5 1997/09/17 12:19:17 adam * Zebra version corresponds to YAZ version 1.4. * Changed Zebra server so that it doesn't depend on global common_resource. * @@ -342,7 +345,7 @@ static int isamc_trunc_cmp (const void *p1, const void *p2) RSET rset_trunc (ZServerInfo *zi, ISAM_P *isam_p, int no) { - logf (LOG_LOG, "rset_trunc no=%d", no); + logf (LOG_DEBUG, "rset_trunc no=%d", no); if (zi->isam) { if (no < 1) diff --git a/index/zrpn.c b/index/zrpn.c index cc13551..caf9dfd 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.64 1997-09-18 08:59:20 adam + * Revision 1.65 1997-09-22 12:39:06 adam + * Added get_pos method for the ranked result sets. + * + * Revision 1.64 1997/09/18 08:59:20 adam * Extra generic handle for the character mapping routines. * * Revision 1.63 1997/09/17 12:19:18 adam @@ -854,6 +857,7 @@ static RSET rpn_search_APT_relevance (ZServerInfo *zi, parms.key_size = sizeof(struct it_key); parms.max_rec = 1000; parms.cmp = key_compare_it; + parms.get_pos = key_get_pos; parms.is = zi->isam; parms.isc = zi->isamc; parms.no_terms = 0; diff --git a/rset/rsrel.c b/rset/rsrel.c index cfde324..0850aff 100644 --- a/rset/rsrel.c +++ b/rset/rsrel.c @@ -1,10 +1,13 @@ /* - * Copyright (C) 1994-1995, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: rsrel.c,v $ - * Revision 1.16 1997-09-17 12:19:23 adam + * Revision 1.17 1997-09-22 12:39:07 adam + * Added get_pos method for the ranked result sets. + * + * Revision 1.16 1997/09/17 12:19:23 adam * Zebra version corresponds to YAZ version 1.4. * Changed Zebra server so that it doesn't depend on global common_resource. * @@ -101,6 +104,7 @@ struct rset_rel_info { int max_rec; int no_rec; int (*cmp)(const void *p1, const void *p2); + int (*get_pos)(const void *p); char *key_buf; /* key buffer */ float *score_buf; /* score buffer */ int *sort_idx; /* score sorted index */ @@ -212,7 +216,7 @@ static void relevance (struct rset_rel_info *info, rset_relevance_parms *parms) #if 0 while (1) { - int min = -1; + int r, min = -1; int pos = 0; for (i = 0; ino_isam_positions; i++) if (isam_r[i] && @@ -221,7 +225,14 @@ static void relevance (struct rset_rel_info *info, rset_relevance_parms *parms) min = i; if (min < 0) break; - pos = (*parms->get_pos)(isam_buf[min]); + i = min; + pos = (*parms->get_pos)(isam_buf[i]); + logf (LOG_LOG, "pos=%d", pos); + if (isam_pt) + isam_r[i] = is_readkey (isam_pt[i], isam_buf[i]); + else if (isamc_pp) + isam_r[i] = isc_pp_read (isamc_pp[i], isam_buf[i]); + } #else while (1) { @@ -315,6 +326,7 @@ static void *r_create (const struct rset_control *sel, void *parms, info->max_rec = r_parms->max_rec; assert (info->max_rec > 1); info->cmp = r_parms->cmp; + info->get_pos = r_parms->get_pos; info->key_buf = xmalloc (info->key_size * info->max_rec); info->score_buf = xmalloc (sizeof(*info->score_buf) * info->max_rec);