From f5eb6612606c3365834ea5aad430b364902d42a3 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Tue, 11 Dec 2012 15:17:42 +0100 Subject: [PATCH] Properly escape \ in non-regexp searches --- index/rpnsearch.c | 2 +- test/charmap/charmap1.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/index/rpnsearch.c b/index/rpnsearch.c index ff57c68..7733a5d 100644 --- a/index/rpnsearch.c +++ b/index/rpnsearch.c @@ -204,7 +204,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, diff --git a/test/charmap/charmap1.c b/test/charmap/charmap1.c index f9a6ba8..82f242f 100644 --- a/test/charmap/charmap1.c +++ b/test/charmap/charmap1.c @@ -77,7 +77,13 @@ static void tst(int argc, char **argv) YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 [", 1)); /* search \ in title:0 . */ - YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 \\\\\\\\", 1)); + YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 \\\\", 1)); + + /* search \ in title:0 . Process # in term */ + YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 @attr 5=101 \\\\", 1)); + + /* search \ in title:0 . RegExpr-1 */ + YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 @attr 5=102 \\\\\\\\", 1)); /* search { in title:0 . */ YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 4=3 @attr 1=4 \\{", 1)); -- 1.7.10.4