--- trunk/t/swish.t 2004/12/04 17:49:20 8 +++ trunk/t/swish.t 2004/12/05 00:59:50 9 @@ -2,8 +2,9 @@ use strict; -use Test::More tests => 11; +use Test::More tests => 22; use Test::Exception; +use lib '.'; use blib; BEGIN { @@ -20,6 +21,7 @@ $i = SWISH::PlusPlus->open( index_dir => $index, debug => 0, + meta_in_body => 1, ); ok($i, "open index"); @@ -31,6 +33,12 @@ ok($i->index_document( 42 => 'meaning of life' ), "index 42"); +ok($i->add( + path => 'life', + title => 'Ultimate question answer found here', + body => '42 is answer to all questions' +), "index life"); + # add one dummy document so that swish++ won't reject all words # with index of just one document ok($i->index_document( _dummy_ => '' ), "fillter"); @@ -41,3 +49,8 @@ my @r = $i->search($word); cmp_ok(scalar @r, '==', 1, "find $word"); } + +foreach my $word (qw(Ultimate question answer found here)) { + cmp_ok(scalar $i->search("title=($word)"), '==', 1, "find $word in title"); + cmp_ok(scalar $i->search("$word"), '==', 1, "find $word anywhere"); +}