X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzrpn.c;h=4f50db2eae6ceb49c9edb220e2ea174bb9d6642f;hb=9af45a7f129664e5f802ff1cdfce08fbce8b1adb;hp=3d1eeeb45dcdd60d06d54bc64f5506f8113c6c43;hpb=8c1de7f1c9610a8da280fe93d785054ce86e7330;p=idzebra-moved-to-github.git diff --git a/index/zrpn.c b/index/zrpn.c index 3d1eeeb..4f50db2 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -4,7 +4,13 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.19 1995-10-06 10:43:56 adam + * Revision 1.21 1995-10-06 13:52:06 adam + * Bug fixes. Handler may abort further scanning. + * + * Revision 1.20 1995/10/06 11:06:33 adam + * Scan entries include 'occurrences' now. + * + * Revision 1.19 1995/10/06 10:43:56 adam * Scan added. 'occurrences' in scan entries not set yet. * * Revision 1.18 1995/10/04 16:57:20 adam @@ -675,25 +681,45 @@ int rpn_search (ZServerInfo *zi, return zi->errCode; count_set (rset, hits); resultSetAdd (zi, setname, 1, rset); + if (zi->errCode) + logf (LOG_DEBUG, "search error: %d", zi->errCode); return zi->errCode; } static struct scan_entry *scan_list; static ODR scan_odr; static int scan_before, scan_after; -static int scan_prefix; +static ISAM scan_isam; +static char scan_prefix[20]; static int scan_handle (Dict_char *name, const char *info, int pos) { - int idx; + int len_prefix, idx; + ISAM_P isam_p; + RSET rset; + rset_isam_parms parms; + + len_prefix = strlen(scan_prefix); + if (memcmp (name, scan_prefix, len_prefix)) + return 1; if (pos > 0) idx = scan_after - pos + scan_before; else idx = - pos - 1; - scan_list[idx].term = odr_malloc (scan_odr, strlen(name + scan_prefix)+1); - strcpy (scan_list[idx].term, name + scan_prefix); + scan_list[idx].term = odr_malloc (scan_odr, strlen(name + len_prefix)+1); + strcpy (scan_list[idx].term, name + len_prefix); + assert (*info == sizeof(isam_p)); + memcpy (&isam_p, info+1, sizeof(isam_p)); + parms.is = scan_isam; + parms.pos = isam_p; +#if 1 + rset = rset_create (rset_kind_isam, &parms); + count_set (rset, &scan_list[idx].occurrences); + rset_delete (rset); +#else scan_list[idx].occurrences = 1; +#endif logf (LOG_DEBUG, "pos=%3d idx=%3d name=%s", pos, idx, name); return 0; } @@ -718,14 +744,18 @@ int rpn_scan (ZServerInfo *zi, ODR odr, Z_AttributesPlusTerm *zapt, logf (LOG_DEBUG, "scan, before = %d, after = %d", before, after); + scan_isam = zi->wordIsam; scan_list = *list = odr_malloc (odr, (before+after)*sizeof(**list)); + for (j = 0; ju.general->len; if (sizez > IT_MAX_WORD) sizez = IT_MAX_WORD; @@ -734,6 +764,9 @@ int rpn_scan (ZServerInfo *zi, ODR odr, Z_AttributesPlusTerm *zapt, termz[j+i] = '\0'; dict_scan (zi->wordDict, termz, &before, &after, scan_handle); + + if (zi->errCode) + logf (LOG_DEBUG, "search error: %d", zi->errCode); return 0; }