X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fapi%2Ft5.c;h=b185126da2d612d81dbc7baf65bad52f0b2c8bab;hb=4ff69ae35942e69d6947ff169febc26d5db8dddf;hp=9199b738973a2162b66884e1f95877cd56b11181;hpb=3f837255e2e97bd39ffabb13621d398f5610348c;p=idzebra-moved-to-github.git diff --git a/test/api/t5.c b/test/api/t5.c index 9199b73..b185126 100644 --- a/test/api/t5.c +++ b/test/api/t5.c @@ -1,4 +1,4 @@ -/* $Id: t5.c,v 1.23 2007-05-25 12:17:11 adam Exp $ +/* $Id: t5.c,v 1.25 2007-12-03 14:33:35 adam Exp $ Copyright (C) 1995-2007 Index Data ApS @@ -20,7 +20,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 +126,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 +224,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)); }