From: Adam Dickmeiss Date: Thu, 12 Oct 1995 12:40:54 +0000 (+0000) Subject: Bug fixes in rpn_prox. X-Git-Tag: ZEBRA.1.0~704 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=817315213374bf6b9a484f7e74fd4913d99c0755;p=idzebra-moved-to-github.git Bug fixes in rpn_prox. --- diff --git a/index/zrpn.c b/index/zrpn.c index 9f27ad5..5fbaca4 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.25 1995-10-10 13:59:24 adam + * Revision 1.26 1995-10-12 12:40:54 adam + * Bug fixes in rpn_prox. + * + * Revision 1.25 1995/10/10 13:59:24 adam * Function rset_open changed its wflag parameter to general flags. * * Revision 1.24 1995/10/09 16:18:37 adam @@ -573,12 +576,24 @@ static RSET rpn_prox (RSET *rset, int rset_no) rsfd = xmalloc (sizeof(*rsfd)*rset_no); more = xmalloc (sizeof(*more)*rset_no); buf = xmalloc (sizeof(*buf)*rset_no); - + for (i = 0; i= 0) + { + rset_close (rset[i], rsfd[i]); + xfree (buf[i]); + --i; + } + xfree (rsfd); + xfree (more); + xfree (buf); + return rset_create (rset_kind_null, NULL); + } } parms.key_size = sizeof (struct it_key); result = rset_create (rset_kind_temp, &parms); @@ -668,24 +683,23 @@ static RSET rpn_search_APT_phrase (ZServerInfo *zi, grep_info.isam_p_indx = 0; if (trunc_term (zi, zapt, term_sub, attributeSet, &grep_info)) return NULL; - if (grep_info.isam_p_indx > 0) + if (grep_info.isam_p_indx == 0) + rset[rset_no] = rset_create (rset_kind_null, NULL); + else if (grep_info.isam_p_indx > 1) + rset[rset_no] = rset_trunc (zi->wordIsam, + grep_info.isam_p_buf, 0, + grep_info.isam_p_indx, 400); + else { - if (grep_info.isam_p_indx > 1) - rset[rset_no] = rset_trunc (zi->wordIsam, - grep_info.isam_p_buf, 0, - grep_info.isam_p_indx, 400); - else - { - rset_isam_parms parms; - - parms.is = zi->wordIsam; - parms.pos = *grep_info.isam_p_buf; - rset[rset_no] = rset_create (rset_kind_isam, &parms); - } - rset_no++; - if (rset_no >= sizeof(rset)/sizeof(*rset)) - break; + rset_isam_parms parms; + + parms.is = zi->wordIsam; + parms.pos = *grep_info.isam_p_buf; + rset[rset_no] = rset_create (rset_kind_isam, &parms); } + assert (rset[rset_no]); + if (++rset_no >= sizeof(rset)/sizeof(*rset)) + break; if (!p1) break; p0 = p1; diff --git a/index/zserver.c b/index/zserver.c index b036efe..c07899c 100644 --- a/index/zserver.c +++ b/index/zserver.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zserver.c,v $ - * Revision 1.14 1995-10-09 16:18:37 adam + * Revision 1.15 1995-10-12 12:40:55 adam + * Bug fixes in rpn_prox. + * + * Revision 1.14 1995/10/09 16:18:37 adam * Function dict_lookup_grep got extra client data parameter. * * Revision 1.13 1995/10/06 14:38:00 adam @@ -71,33 +74,38 @@ bend_initresult *bend_init (bend_initrequest *q) r.errstring = 0; r.handle = name; + logf (LOG_DEBUG, "bend_init"); server_info.sets = NULL; if (!(server_info.sys_idx_fd = open (FNAME_SYS_IDX, O_RDONLY))) { + logf (LOG_WARN|LOG_ERRNO, "sys_idx open fail"); r.errcode = 1; - r.errstring = "dict_open fail: filedict"; + r.errstring = "sys_idx open fail"; return &r; } if (!(server_info.fileDict = dict_open (FNAME_FILE_DICT, 10, 0))) { + logf (LOG_WARN, "dict_open fail: fname dict"); r.errcode = 1; - r.errstring = "dict_open fail: filedict"; + r.errstring = "dict_open fail: fname dict"; return &r; } if (!(server_info.wordDict = dict_open (FNAME_WORD_DICT, 40, 0))) { + logf (LOG_WARN, "dict_open fail: word dict"); dict_close (server_info.fileDict); r.errcode = 1; - r.errstring = "dict_open fail: worddict"; + r.errstring = "dict_open fail: word dict"; return &r; } if (!(server_info.wordIsam = is_open (FNAME_WORD_ISAM, key_compare, 0, sizeof (struct it_key)))) { + logf (LOG_WARN, "is_open fail: word isam"); dict_close (server_info.wordDict); dict_close (server_info.fileDict); r.errcode = 1; - r.errstring = "is_open fail: wordisam"; + r.errstring = "is_open fail: word isam"; return &r; } server_info.odr = odr_createmem (ODR_ENCODE); @@ -160,12 +168,12 @@ static int record_fetch (ZServerInfo *zi, int sysno, int score, ODR stream, file_type); exit (1); } + logf (LOG_DEBUG, "retrieve localno=%d score=%d", sysno, score); if ((retrieveCtrl.fd = open (fname, O_RDONLY)) == -1) { - logf (LOG_FATAL|LOG_ERRNO, "Retrieve: Open record file %s", fname); - exit (1); + logf (LOG_WARN|LOG_ERRNO, "Retrieve: Open record file %s", fname); + return 14; /* System error in presenting records */ } - logf (LOG_DEBUG, "retrieve localno=%d score=%d", sysno, score); retrieveCtrl.localno = sysno; retrieveCtrl.score = score; retrieveCtrl.odr = stream;