X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fapi%2Ft5.c;h=23c4301a4e54bfcb80c41ead3833b313ac1f585e;hb=97a7adeb9e5059463f039495cc01cfa448463a27;hp=9199b738973a2162b66884e1f95877cd56b11181;hpb=3f837255e2e97bd39ffabb13621d398f5610348c;p=idzebra-moved-to-github.git diff --git a/test/api/t5.c b/test/api/t5.c index 9199b73..23c4301 100644 --- a/test/api/t5.c +++ b/test/api/t5.c @@ -1,8 +1,5 @@ -/* $Id: t5.c,v 1.23 2007-05-25 12:17:11 adam Exp $ - Copyright (C) 1995-2007 - Index Data ApS - -This file is part of the Zebra server. +/* This file is part of the Zebra server. + Copyright (C) 1995-2008 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 @@ -20,7 +17,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -/** t5.c: proximity searches */ +/** \file + \brief test various search attributes */ #include #include "testlib.h" @@ -125,7 +123,10 @@ static void tst(int argc, char **argv) YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=5 tu", 2)); YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=5 title", 2)); - + /* always-matches relation */ + YAZ_CHECK(tl_query(zh, "@attr 1=4 @attr 2=103 {x my}", 3)); + YAZ_CHECK(tl_query_x(zh, "@attr 1=1 @attr 2=103 {x my}", 0, 114)); + /* and searches */ YAZ_CHECK(tl_query(zh, "@and @attr 1=4 notfound @attr 1=4 x", 0)); YAZ_CHECK(tl_query(zh, "@and @attr 1=4 x @attr 1=4 notfound", 0)); @@ -220,7 +221,28 @@ static void tst(int argc, char **argv) /* provoke unsupported relation */ YAZ_CHECK(tl_query_x(zh, "@attr 1=4 @attr 2=6 x", 0, 117)); YAZ_CHECK(tl_query_x(zh, "@attr 1=1016 @attr 2=6 @attr 4=109 x", 0, 114)); - + + /* position , phrase searches */ + YAZ_CHECK(tl_query(zh, "@attr 3=1 title", 0)); + YAZ_CHECK(tl_query(zh, "@attr 3=1 my", 3)); + + YAZ_CHECK(tl_query(zh, "@attr 3=1 {my title}", 2)); + YAZ_CHECK(tl_query(zh, "@attr 4=1 @attr 3=1 {my title}", 2)); + + YAZ_CHECK(tl_query(zh, "@attr 3=1 {title my}", 0)); + YAZ_CHECK(tl_query(zh, "@attr 4=1 @attr 3=1 {title my}", 0)); + + YAZ_CHECK(tl_query(zh, "@attr 4=1 @attr 3=1 {title my}", 0)); + + /* position , or-list */ + YAZ_CHECK(tl_query(zh, "@attr 4=105 @attr 3=1 {title my}", 3)); + YAZ_CHECK(tl_query(zh, "@attr 4=105 @attr 3=1 {title x}", 0)); + + /* position, and-list */ + YAZ_CHECK(tl_query(zh, "@attr 4=6 @attr 3=1 {title my}", 0)); + YAZ_CHECK(tl_query(zh, "@attr 4=6 @attr 3=1 {title x}", 0)); + YAZ_CHECK(tl_query(zh, "@attr 4=6 @attr 3=1 my", 3)); + YAZ_CHECK(tl_close_down(zh, zs)); }