1 /* $Id: safari1.c,v 1.11 2006-05-10 08:13:35 adam Exp $
2 Copyright (C) 1995-2005
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with Zebra; see the file LICENSE.zebra. If not, write to the
19 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 /* safari1 - insert a few Safari records */
29 "1234\n" /* ID first record */
30 /* chunk owner seq idx term */
31 "00024338 125060 1 any the\n"
32 "00024338 125060 2 any art\n"
33 "00024338 125060 3 any mand\n",
35 "5678\n" /* other record - same owner id */
36 "00024339 125060 1 any den\n"
37 "00024339 125060 2 any gamle\n"
38 "00024339 125060 3 any mand\n",
40 "5678\n" /* same record chunk id as before .. */
41 "00024339 125060 1 any the\n"
42 "00024339 125060 2 any gamle\n"
43 "00024339 125060 3 any mand\n",
45 "1000\n" /* separate record */
46 "00024339 125061 1 any the\n"
47 "00024339 125061 2 any gamle\n"
48 "00024339 125061 3 any mand\n",
50 "1001\n" /* separate record */
51 "00024340 125062 1 any the\n"
52 "00024340 125062 1 any the\n" /* DUP KEY, bug #432 */
53 "00024340 125062 2 any old\n"
54 "00024340 125062 3 any mand\n",
59 static void tst(int argc, char **argv)
63 ZebraService zs = tl_start_up("safari.cfg", argc, argv);
65 ZebraHandle zh = zebra_open(zs, 0);
67 YAZ_CHECK(tl_init_data(zh, myrec));
69 YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=any the", 3));
70 YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=any @and the art", 1));
71 YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=any @and den gamle", 0));
72 YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=any @and the gamle", 1));
73 YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=any @and the of", 0));
75 /* verify that we get these records exactly */
79 YAZ_CHECK(tl_meta_query(zh, "@attr 4=3 @attr 1=any mand", 3, ids));
84 zebra_set_limit(zh, 0, limits);
86 YAZ_CHECK(tl_meta_query(zh, "@attr 4=3 @attr 1=any mand", 1, ids));
88 /* limit to 125060, 125061 */
92 zebra_set_limit(zh, 0, limits);
95 YAZ_CHECK(tl_meta_query(zh, "@attr 4=3 @attr 1=any mand", 2, ids));
97 /* all except 125062 */
100 zebra_set_limit(zh, 1, limits);
104 YAZ_CHECK(tl_meta_query(zh, "@attr 4=3 @attr 1=any mand", 2, ids));
107 zebra_set_limit(zh, 1, 0);
108 YAZ_CHECK(tl_query(zh, "@attr 4=3 @attr 1=any mand", 3));
110 YAZ_CHECK(tl_close_down(zh, zs));
117 * indent-tabs-mode: nil
119 * vim: shiftwidth=4 tabstop=8 expandtab