+Fix bug. X-Path attribute expressions with spaces in them now works.
+
Fix base address for MARC output.
--- 1.3.14 2003/11/29
-/* $Id: zebraapi.h,v 1.10 2003-08-21 10:30:04 adam Exp $
+/* $Id: zebraapi.h,v 1.11 2004-01-15 13:31:31 adam Exp $
Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
Index Data Aps
/* Search using RPN Query */
YAZ_EXPORT int zebra_search_RPN (ZebraHandle zh, ODR o, Z_RPNQuery *query,
- const char *setname, int *hits);
+ const char *setname, int *hits);
/* Retrieve record(s) */
YAZ_EXPORT int zebra_records_retrieve (ZebraHandle zh, ODR stream,
-/* $Id: zrpn.c,v 1.134 2003-09-05 10:51:17 adam Exp $
- Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003
+/* $Id: zrpn.c,v 1.135 2004-01-15 13:31:31 adam Exp $
+ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
Index Data Aps
This file is part of the Zebra server.
xpath[level].predicate->which == XPATH_PREDICATE_RELATION &&
xpath[level].predicate->u.relation.name[0])
{
- char predicate_str[128];
-
- strcpy (predicate_str,
- xpath[level].predicate->u.relation.name+1);
+ WRBUF wbuf = wrbuf_alloc();
+ wrbuf_puts(wbuf, xpath[level].predicate->u.relation.name+1);
if (xpath[level].predicate->u.relation.value)
{
- strcat (predicate_str, "=");
- strcat (predicate_str,
- xpath[level].predicate->u.relation.value);
+ const char *cp = xpath[level].predicate->u.relation.value;
+ wrbuf_putc(wbuf, '=');
+
+ while (*cp)
+ {
+ if (strchr(REGEX_CHARS, *cp))
+ wrbuf_putc(wbuf, '\\');
+ wrbuf_putc(wbuf, *cp);
+ cp++;
+ }
}
+ wrbuf_puts(wbuf, "");
rset_attr = xpath_trunc (
- zh, stream, '0', predicate_str, 3, curAttributeSet);
+ zh, stream, '0', wrbuf_buf(wbuf), 3, curAttributeSet);
+ wrbuf_free(wbuf, 1);
}
else
{
-# $Id: Makefile.am,v 1.4 2003-05-21 14:39:23 adam Exp $
+# $Id: Makefile.am,v 1.5 2004-01-15 13:31:31 adam Exp $
-check_SCRIPTS = test1.sh test2.sh test3.sh simple1.sh
+check_SCRIPTS = simple1.sh test1.sh test2.sh test3.sh test4.sh
TESTS = $(check_SCRIPTS)
-EXTRA_DIST = zebra.cfg rec.xml simple1.xml $(check_SCRIPTS)
+EXTRA_DIST = zebra.cfg rec.xml simple1.xml rec4.xml $(check_SCRIPTS)
--- /dev/null
+<root>
+ <!-- Space in attribute -->
+ <first attr="danish">content</first>
+ <second attr="danish lake">content</second>
+ <!-- Oslash in Latin-1 encoded below.. -->
+ <third attr="dansk sø">content<third>
+</root>
--- /dev/null
+#!/bin/sh
+# $Id: test4.sh,v 1.1 2004-01-15 13:31:31 adam Exp $
+LOG=test4.log
+TMP1=test4-1.tmp
+TMP2=test4-2.tmp
+TMP3=test4-3.tmp
+TMP4=test4-4.tmp
+TMP5=test4-5.tmp
+rm -f $LOG
+rm -f $TMP
+../../index/zebraidx -l $LOG init || exit 1
+../../index/zebraidx -l $LOG -t grs.sgml update rec4.xml || exit 2
+test -f dict*.mf || exit 1
+../../index/zebrasrv -l $LOG -S unix:socket &
+sleep 1
+test -f zebrasrv.pid || exit 2
+../api/testclient unix:socket '@attr 1=/root content' >$TMP1
+../api/testclient unix:socket '@attr 1=/root/first content' >$TMP2
+../api/testclient unix:socket "@attr {1=/root/first[@attr='danish']} content" >$TMP3
+../api/testclient unix:socket "@attr {1=/root/second[@attr='danish lake']} content" >$TMP4
+../api/testclient unix:socket "@attr {1=/root/third[@attr='dansk sø']} content" >$TMP5
+echo 'Killing server' >>$LOG
+kill `cat zebrasrv.pid` || exit 3
+cat $TMP1 $TMP2 $TMP3 $TMP4 $TMP5 >>$LOG
+echo 'Checking that result count is 1' >>$LOG
+grep "^Result count: 1$" $TMP1 >/dev/null || exit 4
+echo 'Checking that result count is 1' >>$LOG
+grep "^Result count: 1$" $TMP2 >/dev/null || exit 5
+echo 'Checking that result count is 1' >>$LOG
+grep "^Result count: 1$" $TMP3 >/dev/null || exit 6
+echo 'Checking that result count is 1' >>$LOG
+grep "^Result count: 1$" $TMP4 >/dev/null || exit 7
+echo 'Checking that result count is 1' >>$LOG
+grep "^Result count: 1$" $TMP5 >/dev/null || exit 8
+echo 'Test OK' >>$LOG
+exit 0
+