1 /* $Id: t5.c,v 1.11 2005-01-15 19:38: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 /** t5.c: proximity searches */
26 const char *myrec[] = {
27 "<gils>\n<title>My title</title>\n</gils>\n",
28 "<gils>\n<title>My x title</title>\n</gils>\n",
29 "<gils>\n<title>My title x</title>\n</gils>\n" ,
33 int main(int argc, char **argv)
35 ZebraService zs = start_up(0, argc, argv);
36 ZebraHandle zh = zebra_open(zs);
40 do_query(__LINE__,zh, "@attr 1=4 my", 3);
41 do_query(__LINE__,zh, "@attr 1=4 {my x}", 1);
42 do_query(__LINE__,zh, "@attr 1=4 {my x}", 1);
43 do_query(__LINE__,zh, "@attr 1=4 {x my}", 0);
44 do_query(__LINE__,zh, "@attr 1=4 {my x title}", 1);
45 do_query(__LINE__,zh, "@attr 1=4 {my title}", 2);
46 do_query(__LINE__,zh, "@attr 1=4 @and x title", 2);
48 /* exl=0 distance=2 order=1 relation=2 (<=), known, unit=word */
49 do_query(__LINE__,zh, "@prox 0 2 1 2 k 2 my x", 2);
51 /* exl=0 distance=2 order=1 relation=2 (<=), known, unit=word */
52 do_query(__LINE__,zh, "@prox 0 2 1 2 k 2 x my", 0);
54 /* exl=0 distance=2 order=0 relation=2 (<=), known, unit=word */
55 do_query(__LINE__,zh, "@prox 0 2 0 2 k 2 x my", 2);
57 /* exl=0 distance=2 order=0 relation=3 (=), known, unit=word */
58 do_query(__LINE__,zh, "@prox 0 2 1 3 k 2 my x", 1);
60 /* exl=1 distance=2 order=0 relation=3 (=), known, unit=word */
61 do_query(__LINE__,zh, "@prox 1 2 1 3 k 2 my x", 1);
63 return close_down(zh, zs, 0);