X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=index%2Frpnsearch.c;h=0bbfdf1f40da622a3d42d3901053d8d3296b1919;hb=4e6078e4660869b9d83223c8ce842ed8dda211ab;hp=a8cc61db25ff989cca25b60e0e50acc3e23e950d;hpb=97a7adeb9e5059463f039495cc01cfa448463a27;p=idzebra-moved-to-github.git diff --git a/index/rpnsearch.c b/index/rpnsearch.c index a8cc61d..0bbfdf1 100644 --- a/index/rpnsearch.c +++ b/index/rpnsearch.c @@ -1,5 +1,5 @@ /* This file is part of the Zebra server. - Copyright (C) 1995-2008 Index Data + Copyright (C) 1994-2009 Index Data Zebra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free @@ -203,7 +203,7 @@ static void esc_str(char *out_buf, size_t out_size, } } -#define REGEX_CHARS " []()|.*+?!\"$" +#define REGEX_CHARS " ^[]()|.*+?!\"$" static void add_non_space(const char *start, const char *end, WRBUF term_dict, @@ -1035,28 +1035,45 @@ static ZEBRA_RES string_term(ZebraHandle zh, Z_AttributesPlusTerm *zapt, if (zebra_maps_is_icu(zm)) { - /* ICU case */ - switch (truncation_value) + int relation_value; + AttrType relation; + + attr_init_APT(&relation, zapt, 2); + relation_value = attr_find(&relation, NULL); + if (relation_value == 103) /* always matches */ + termp += strlen(termp); /* move to end of term */ + else if (relation_value == 3 || relation_value == 102 || relation_value == -1) { - case -1: /* not specified */ - case 100: /* do not truncate */ - if (!term_100_icu(zm, &termp, term_dict, space_split, display_term, 0)) + /* ICU case */ + switch (truncation_value) { - *term_sub = 0; - return ZEBRA_OK; - } - break; - case 1: /* right truncation */ - if (!term_100_icu(zm, &termp, term_dict, space_split, display_term, 1)) - { - *term_sub = 0; - return ZEBRA_OK; + case -1: /* not specified */ + case 100: /* do not truncate */ + if (!term_100_icu(zm, &termp, term_dict, space_split, display_term, 0)) + { + *term_sub = 0; + return ZEBRA_OK; + } + break; + case 1: /* right truncation */ + if (!term_100_icu(zm, &termp, term_dict, space_split, display_term, 1)) + { + *term_sub = 0; + return ZEBRA_OK; + } + break; + default: + zebra_setError_zint(zh, + YAZ_BIB1_UNSUPP_TRUNCATION_ATTRIBUTE, + truncation_value); + return ZEBRA_FAIL; } - break; - default: + } + else + { zebra_setError_zint(zh, - YAZ_BIB1_UNSUPP_TRUNCATION_ATTRIBUTE, - truncation_value); + YAZ_BIB1_UNSUPP_RELATION_ATTRIBUTE, + relation_value); return ZEBRA_FAIL; } } @@ -2628,6 +2645,7 @@ ZEBRA_RES rpn_search_structure(ZebraHandle zh, Z_RPNStructure *zs, /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab