X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Fzrpn.c;h=3a61c473a1afb9f2582c5e3d422a52b03f8b5f2a;hb=ba572d8e1de44023f355c09c4250328aba0e9a47;hp=4e1acd9e758fbfca21de02ba6584430385c0ce54;hpb=eb2b742588ce07fb4516bbca22c93b938b13e433;p=idzebra-moved-to-github.git diff --git a/index/zrpn.c b/index/zrpn.c index 4e1acd9..3a61c47 100644 --- a/index/zrpn.c +++ b/index/zrpn.c @@ -1,10 +1,24 @@ /* - * Copyright (C) 1995-1999, Index Data + * Copyright (C) 1995-2001, Index Data * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: zrpn.c,v $ - * Revision 1.102 2000-03-15 15:00:31 adam + * Revision 1.106 2001-04-11 07:58:13 adam + * Bug fix: multiple space mapped to one space when using complete subfield. + * + * Revision 1.105 2000/11/08 13:46:59 adam + * Fixed scan: server could break if bad attribute/database was selected. + * Work on remote update. + * + * Revision 1.104 2000/04/05 09:49:35 adam + * On Unix, zebra/z'mbol uses automake. + * + * Revision 1.103 2000/03/20 19:08:36 adam + * Added remote record import using Z39.50 extended services and Segment + * Requests. + * + * Revision 1.102 2000/03/15 15:00:31 adam * First work on threaded version. * * Revision 1.101 2000/03/02 14:35:03 adam @@ -567,6 +581,9 @@ static int term_100 (ZebraMaps zebra_maps, int reg_type, int i = 0; int j = 0; + const char *space_start = 0; + const char *space_end = 0; + if (!term_pre (zebra_maps, reg_type, src, NULL, NULL)) return 0; s0 = *src; @@ -574,8 +591,33 @@ static int term_100 (ZebraMaps zebra_maps, int reg_type, { s1 = s0; map = zebra_maps_input (zebra_maps, reg_type, &s0, strlen(s0)); - if (space_split && **map == *CHR_SPACE) - break; + if (space_split) + { + if (**map == *CHR_SPACE) + break; + } + else /* complete subfield only. */ + { + if (**map == *CHR_SPACE) + { /* save space mapping for later .. */ + space_start = s1; + space_end = s0; + continue; + } + else if (space_start) + { /* reload last space */ + while (space_start < space_end) + { + if (!isalnum (*space_start) && *space_start != '-') + dst[i++] = '\\'; + dst_term[j++] = *space_start; + dst[i++] = *space_start++; + } + /* and reset */ + space_start = space_end = 0; + } + } + /* add non-space char */ while (s1 < s0) { if (!isalnum (*s1) && *s1 != '-') @@ -1557,7 +1599,7 @@ static RSET rpn_prox (ZebraHandle zh, RSET *rset, int rset_no, } for (i = 0; iservice->zebra_maps, zapt, ®_id, &search_type, &rank_type, &complete_flag, &sort_flag)) { + *num_entries = 0; zh->errCode = 113; return ; } @@ -2514,6 +2557,7 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, { zh->errString = basenames[base_no]; zh->errCode = 109; /* Database unavailable */ + *num_entries = 0; return; } for (local_attr = attp.local_attributes; local_attr && ord_no < 32; @@ -2529,6 +2573,7 @@ void rpn_scan (ZebraHandle zh, ODR stream, Z_AttributesPlusTerm *zapt, } if (ord_no == 0) { + *num_entries = 0; zh->errCode = 113; return; }