Mailing List Archive

r3750 - in trunk: c_src/KinoSearch/Search perl/lib perl/lib/KSx perl/lib/KinoSearch/Doc perl/lib/KinoSearch/Docs/Tutorial perl/lib/KinoSearch/Highlight perl/lib/KinoSearch/Search perl/sample perl/t
Author: creamyg
Date: 2008-08-23 12:36:52 -0700 (Sat, 23 Aug 2008)
New Revision: 3750

Modified:
trunk/c_src/KinoSearch/Search/Hits.bp
trunk/c_src/KinoSearch/Search/Hits.c
trunk/perl/lib/KSx/Simple.pm
trunk/perl/lib/KinoSearch.pm
trunk/perl/lib/KinoSearch/Doc/HitDoc.pm
trunk/perl/lib/KinoSearch/Docs/Tutorial/BeyondSimple.pod
trunk/perl/lib/KinoSearch/Docs/Tutorial/Simple.pod
trunk/perl/lib/KinoSearch/Highlight/Highlighter.pm
trunk/perl/lib/KinoSearch/Search/Hits.pm
trunk/perl/sample/search.cgi
trunk/perl/t/210-deldocs.t
trunk/perl/t/213-segment_merging.t
trunk/perl/t/214-spec_field.t
trunk/perl/t/215-term_vectors.t
trunk/perl/t/302-many_fields.t
trunk/perl/t/303-highlighter.t
trunk/perl/t/304-verify_utf8.t
trunk/perl/t/306-dynamic_schema.t
trunk/perl/t/308-simple.t
trunk/perl/t/501-termquery.t
trunk/perl/t/502-phrasequery.t
trunk/perl/t/504-similarity.t
trunk/perl/t/508-hits.t
trunk/perl/t/510-remote_search.t
trunk/perl/t/511-sort_spec.t
trunk/perl/t/515-range_query.t
trunk/perl/t/525-match_all_query.t
trunk/perl/t/526-not_query.t
trunk/perl/t/602-boosts.t
trunk/perl/t/603-query_boosts.t
trunk/perl/t/605-store_pos_boost.t
trunk/perl/t/606-proximity.t
Log:
Rename Hits->fetch_hit() to Hits->next(), making the API parallel to other
iterators like PostingList, Lexicon, and Scorer.


Modified: trunk/c_src/KinoSearch/Search/Hits.bp
===================================================================
--- trunk/c_src/KinoSearch/Search/Hits.bp 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/c_src/KinoSearch/Search/Hits.bp 2008-08-23 19:36:52 UTC (rev 3750)
@@ -21,7 +21,7 @@
* exhausted.
*/
public incremented HitDoc*
- Fetch_Hit(Hits *self);
+ Next(Hits *self);

/** Return the total number of documents which matched the Query used to
* produce the Hits object. Note that this is the total number of

Modified: trunk/c_src/KinoSearch/Search/Hits.c
===================================================================
--- trunk/c_src/KinoSearch/Search/Hits.c 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/c_src/KinoSearch/Search/Hits.c 2008-08-23 19:36:52 UTC (rev 3750)
@@ -32,7 +32,7 @@
}

HitDoc*
-Hits_fetch_hit(Hits *self)
+Hits_next(Hits *self)
{
ScoreDoc *score_doc
= (ScoreDoc*)VA_Fetch(self->top_docs->score_docs, self->offset);

Modified: trunk/perl/lib/KSx/Simple.pm
===================================================================
--- trunk/perl/lib/KSx/Simple.pm 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/lib/KSx/Simple.pm 2008-08-23 19:36:52 UTC (rev 3750)
@@ -112,12 +112,12 @@
return $self->{hits}->total_hits;
}

-sub fetch_hit {
+sub next {
my $self = shift;
return unless defined $self->{hits};

# Get the hit, bail if hits are exhausted.
- my $hit = $self->{hits}->fetch_hit;
+ my $hit = $self->{hits}->next;
if ( !defined $hit ) {
undef $self->{hits};
return;
@@ -175,7 +175,7 @@
);

print "Total hits: $total_hits\n";
- while ( my $hit = $index->fetch_hit ) {
+ while ( my $hit = $index->next ) {
print "$hit->{title}\n",
}


Modified: trunk/perl/lib/KinoSearch/Doc/HitDoc.pm
===================================================================
--- trunk/perl/lib/KinoSearch/Doc/HitDoc.pm 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/lib/KinoSearch/Doc/HitDoc.pm 2008-08-23 19:36:52 UTC (rev 3750)
@@ -7,7 +7,7 @@
__AUTO_XS__

my $synopsis = <<'END_SYNOPSIS';
- while ( my $hit_doc = $hits->fetch_hit ) {
+ while ( my $hit_doc = $hits->next ) {
print $hit_doc->{title};
print $hit_doc->get_score;
...

Modified: trunk/perl/lib/KinoSearch/Docs/Tutorial/BeyondSimple.pod
===================================================================
--- trunk/perl/lib/KinoSearch/Docs/Tutorial/BeyondSimple.pod 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/lib/KinoSearch/Docs/Tutorial/BeyondSimple.pod 2008-08-23 19:36:52 UTC (rev 3750)
@@ -149,7 +149,7 @@

...

- while ( my $hit = $hits->fetch_hit ) {
+ while ( my $hit = $hits->next ) {
...
}


Modified: trunk/perl/lib/KinoSearch/Docs/Tutorial/Simple.pod
===================================================================
--- trunk/perl/lib/KinoSearch/Docs/Tutorial/Simple.pod 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/lib/KinoSearch/Docs/Tutorial/Simple.pod 2008-08-23 19:36:52 UTC (rev 3750)
@@ -154,12 +154,12 @@
break up results into "pages" of manageable size.

Calling search() on our Simple object turns it into an iterator. Invoking
-fetch_hit() now returns our stored documents (augmented with a score,
+next() now returns our stored documents (augmented with a score,
accessible via C<get_score>), starting with the most relevant.

# Create result list.
my $report = '';
- while ( my $hit = $simple->fetch_hit ) {
+ while ( my $hit = $simple->next ) {
my $score = sprintf( "%0.3f", $hit->get_score );
my $title = encode_entities( $hit->{title} );
$report .= qq|

Modified: trunk/perl/lib/KinoSearch/Highlight/Highlighter.pm
===================================================================
--- trunk/perl/lib/KinoSearch/Highlight/Highlighter.pm 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/lib/KinoSearch/Highlight/Highlighter.pm 2008-08-23 19:36:52 UTC (rev 3750)
@@ -13,7 +13,7 @@
field => 'body'
);
my $hits = $searcher->search( query => $query );
- while ( my $hit = $hits->fetch_hit ) {
+ while ( my $hit = $hits->next ) {
my $excerpt = $highlighter->create_excerpt($hit);
...
}

Modified: trunk/perl/lib/KinoSearch/Search/Hits.pm
===================================================================
--- trunk/perl/lib/KinoSearch/Search/Hits.pm 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/lib/KinoSearch/Search/Hits.pm 2008-08-23 19:36:52 UTC (rev 3750)
@@ -12,17 +12,17 @@
offset => 0,
num_wanted => 10,
);
- while ( my $hit = $hits->fetch_hit ) {
+ while ( my $hit = $hits->next ) {
print "<p>$hit->{title} <em>" . $hit->get_score . "</em></p>\n";
}
END_SYNOPSIS

{ "KinoSearch::Search::Hits" => {
- bind_methods => [qw( total_hits fetch_hit )],
+ bind_methods => [qw( total_hits next )],
make_constructors => ["new"],
make_pod => {
synopsis => $synopsis,
- methods => [qw( fetch_hit total_hits )],
+ methods => [qw( next total_hits )],
}
}
}

Modified: trunk/perl/lib/KinoSearch.pm
===================================================================
--- trunk/perl/lib/KinoSearch.pm 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/lib/KinoSearch.pm 2008-08-23 19:36:52 UTC (rev 3750)
@@ -674,7 +674,7 @@
);

my $hits = $searcher->search( query => "foo bar" );
- while ( my $hit = $hits->fetch_hit ) {
+ while ( my $hit = $hits->next ) {
print "$hit->{title}\n";
}


Modified: trunk/perl/sample/search.cgi
===================================================================
--- trunk/perl/sample/search.cgi 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/sample/search.cgi 2008-08-23 19:36:52 UTC (rev 3750)
@@ -38,7 +38,7 @@

# Create result list.
my $report = '';
-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
my $score = sprintf( "%0.3f", $hit->get_score );
my $title = encode_entities( $hit->{title} );
my $excerpt = $highlighter->create_excerpt($hit);

Modified: trunk/perl/t/210-deldocs.t
===================================================================
--- trunk/perl/t/210-deldocs.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/210-deldocs.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -94,7 +94,7 @@
for ( 'a' .. 'e' ) {
$hits = $searcher->search( query => $_ );
my @contents;
- while ( my $hit = $hits->fetch_hit ) {
+ while ( my $hit = $hits->next ) {
push @contents, $hit->{content};
}
push @expected, \@contents;
@@ -106,7 +106,7 @@
for ( 'a' .. 'e' ) {
$hits = $searcher->search( query => $_ );
my @contents;
- while ( my $hit = $hits->fetch_hit ) {
+ while ( my $hit = $hits->next ) {
push @contents, $hit->{content};
}
push @got, \@contents;

Modified: trunk/perl/t/213-segment_merging.t
===================================================================
--- trunk/perl/t/213-segment_merging.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/213-segment_merging.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -85,7 +85,7 @@
$hits = $searcher->search( query => 'b' );
is( $hits->total_hits, 10, "correct total_hits from merged invindex" );
my @got;
- push @got, $hits->fetch_hit->{content} for 1 .. $hits->total_hits;
+ push @got, $hits->next->{content} for 1 .. $hits->total_hits;
is_deeply( \@got, \@correct,
"correct top scoring hit from merged invindex" );

@@ -116,7 +116,7 @@
invindex => BiggerSchema->read($invindex_loc) );
$hits = $searcher->search( query => 'fish' );
is( $hits->total_hits, 1, "correct total_hits after add_invindex" );
- is( $hits->fetch_hit->{content},
+ is( $hits->next->{content},
'fresh fish', "other invindexes successfully absorbed" );
undef $searcher;
undef $hits;

Modified: trunk/perl/t/214-spec_field.t
===================================================================
--- trunk/perl/t/214-spec_field.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/214-spec_field.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -84,7 +84,7 @@
# Don't check the contents of the hit if there aren't any.
return unless $expected_num_hits;

- my $hit = $hits->fetch_hit;
+ my $hit = $hits->next;
is( $hit->{$field_name},
'United States',
"$field_name correct doc returned"

Modified: trunk/perl/t/215-term_vectors.t
===================================================================
--- trunk/perl/t/215-term_vectors.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/215-term_vectors.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -93,7 +93,7 @@

$searcher = KinoSearch::Searcher->new( invindex => $alt_invindex );
my $hits = $searcher->search( query => $hasta );
-my $hit_id = $hits->fetch_hit->get_doc_num;
+my $hit_id = $hits->next->get_doc_num;
$doc_vec = $searcher->fetch_doc_vec($hit_id);
$term_vector = $doc_vec->term_vector( field => 'content', term => 'mañana' );
ok( defined $term_vector, "utf-8 term vector retrieved after merge" );

Modified: trunk/perl/t/302-many_fields.t
===================================================================
--- trunk/perl/t/302-many_fields.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/302-many_fields.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -47,5 +47,5 @@
);
is( $hits->total_hits, 2,
"correct number of hits for $num_fields fields" );
- my $top_hit = $hits->fetch_hit;
+ my $top_hit = $hits->next;
}

Modified: trunk/perl/t/303-highlighter.t
===================================================================
--- trunk/perl/t/303-highlighter.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/303-highlighter.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -219,7 +219,7 @@
field => 'content',
);

-my $hit = $hits->fetch_hit;
+my $hit = $hits->next;
my $excerpt = $hl->create_excerpt($hit);
like( $excerpt, qr/$encoded_phi.*?z/i,
"excerpt contains all relevant terms" );
@@ -237,7 +237,7 @@
qr#\e\[.1m$encoded_phi\e\[.0m#i, "set_pre_tag and set_post_tag",
);

-like( $hl->create_excerpt( $hits->fetch_hit() ),
+like( $hl->create_excerpt( $hits->next() ),
qr/x/,
"excerpt field with partial hit doesn't cause highlighter freakout" );

@@ -247,7 +247,7 @@
query => $q,
field => 'content',
);
-$excerpt = $hl->create_excerpt( $hits->fetch_hit() );
+$excerpt = $hl->create_excerpt( $hits->next() );
$excerpt =~ s#</?strong>##g;
like( $excerpt, qr/x y z/,
"query with same word in both phrase and term doesn't cause freakout" );
@@ -258,7 +258,7 @@
searchable => $searcher,
query => $q,
field => 'content',
- )->create_excerpt( $hits->fetch_hit() ),
+ )->create_excerpt( $hits->next() ),
qr/quot/,
"HTML entity encoded properly"
);
@@ -269,7 +269,7 @@
searchable => $searcher,
query => $q,
field => 'content',
- )->create_excerpt( $hits->fetch_hit() ),
+ )->create_excerpt( $hits->next() ),
qr/\.\.\./,
"no ellipsis for short excerpt"
);
@@ -279,7 +279,7 @@
term => 'x',
);
$hits = $searcher->search( query => $term_query );
-$hit = $hits->fetch_hit();
+$hit = $hits->next();
like(
KinoSearch::Highlight::Highlighter->new(
searchable => $searcher,
@@ -345,7 +345,7 @@
field => 'content',
);
$hits = $searcher->search( query => 'blind' );
-$hit = $hits->fetch_hit;
+$hit = $hits->next;
like( $hl->create_excerpt($hit),
qr/\*wise\*/, "override both Encode() and Highlight()" );


Modified: trunk/perl/t/304-verify_utf8.t
===================================================================
--- trunk/perl/t/304-verify_utf8.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/304-verify_utf8.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -45,17 +45,17 @@

my $hits = $searcher->search( query => $qparser->parse($smiley) );
is( $hits->total_hits, 1 );
-is( $hits->fetch_hit->{content},
+is( $hits->next->{content},
$smiley, "InvIndexer and QueryParser handle UTF-8 source correctly" );

$hits = $searcher->search( query => $qparser->parse($frowny) );
is( $hits->total_hits, 1 );
-is( $hits->fetch_hit->{content},
+is( $hits->next->{content},
$frowny, "InvIndexer upgrades non-UTF-8 correctly" );

$hits = $searcher->search( query => $qparser->parse($not_a_smiley) );
is( $hits->total_hits, 1 );
-is( $hits->fetch_hit->{content},
+is( $hits->next->{content},
$not_a_smiley, "QueryParser upgrades non-UTF-8 correctly" );

my $term_query = KinoSearch::Search::TermQuery->new(
@@ -64,7 +64,7 @@
);
$hits = $searcher->search( query => $term_query );
is( $hits->total_hits, 1 );
-is( $hits->fetch_hit->{content},
+is( $hits->next->{content},
$not_a_smiley, "TermQuery upgrades non-UTF-8 correctly" );

$term_query = KinoSearch::Search::TermQuery->new(
@@ -74,7 +74,7 @@

$hits = $searcher->search( query => $term_query );
is( $hits->total_hits, 1 );
-is( $hits->fetch_hit->{content},
+is( $hits->next->{content},
$smiley, "TermQuery handles UTF-8 correctly" );

undef $invindexer;

Modified: trunk/perl/t/306-dynamic_schema.t
===================================================================
--- trunk/perl/t/306-dynamic_schema.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/306-dynamic_schema.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -49,7 +49,7 @@
my $hits = $searcher->search( query => 'x', num_wanted => 100 );
is( $hits->total_hits, 3,
"disparate docs successfully indexed and retrieved" );
-my $top_hit = $hits->fetch_hit;
+my $top_hit = $hits->next;
is_deeply( $top_hit->get_fields, \%three_fields,
"all fields stored successfully" );

@@ -80,7 +80,7 @@
$hits = $searcher->search( query => 'stuff', num_wanted => 100 );
is( $hits->total_hits, 1,
"successfully aborbed unknown field during add_invindex" );
-$top_hit = $hits->fetch_hit;
+$top_hit = $hits->next;
delete $top_hit->{score};
is_deeply( $top_hit->get_fields, \%five_fields,
"all fields stored successfully" );

Modified: trunk/perl/t/308-simple.t
===================================================================
--- trunk/perl/t/308-simple.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/308-simple.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -27,8 +27,8 @@
);
is( $index->search( query => 'cream' ), 3, "commit upon destroy" );

-while ( my $hit = $index->fetch_hit ) {
- like( $hit->{food}, qr/cream/, 'fetch_hit' );
+while ( my $hit = $index->next ) {
+ like( $hit->{food}, qr/cream/, 'next' );
}

$index->add_doc( { band => 'Cream' } );

Modified: trunk/perl/t/501-termquery.t
===================================================================
--- trunk/perl/t/501-termquery.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/501-termquery.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -20,10 +20,10 @@
my $hits = $searcher->search( query => $term_query );
is( $hits->total_hits, 2, "correct number of hits returned" );

-my $hit = $hits->fetch_hit;
+my $hit = $hits->next;
is( $hit->{content}, 'c c c d', "most relevant doc is highest" );

-$hit = $hits->fetch_hit;
+$hit = $hits->next;
is( $hit->{content}, 'c d', "second most relevant" );

my $frozen = freeze($term_query);

Modified: trunk/perl/t/502-phrasequery.t
===================================================================
--- trunk/perl/t/502-phrasequery.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/502-phrasequery.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -36,10 +36,10 @@

my $hits = $searcher->search( query => $phrase_query );
is( $hits->total_hits, 3, "correct number of hits" );
-my $first_hit = $hits->fetch_hit;
+my $first_hit = $hits->next;
is( $first_hit->{content}, $best_match, 'best match appears first' );

-my $second_hit = $hits->fetch_hit;
+my $second_hit = $hits->next;
ok( $first_hit->get_score > $second_hit->get_score,
"best match scores higher: "
. $first_hit->get_score . " > "

Modified: trunk/perl/t/504-similarity.t
===================================================================
--- trunk/perl/t/504-similarity.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/504-similarity.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -81,7 +81,7 @@
term => 'spam',
)
);
-is( $hits->fetch_hit->{'title'},
+is( $hits->next->{'title'},
'spam', "Default Similarity biased towards short fields" );

$hits = $searcher->search(
@@ -90,6 +90,6 @@
term => 'spam',
)
);
-is( $hits->fetch_hit->{'title'},
+is( $hits->next->{'title'},
'not spam', "LongFieldSim cancels short-field bias" );


Modified: trunk/perl/t/508-hits.t
===================================================================
--- trunk/perl/t/508-hits.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/508-hits.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -19,12 +19,12 @@
num_wanted => 1,
);
is( $hits->total_hits, 3, "total_hits" );
-my $hit = $hits->fetch_hit;
+my $hit = $hits->next;
cmp_ok( $hit->get_score, '>', 0.0, "score field added" );
-is( $hits->fetch_hit, undef, "hits exhausted" );
+is( $hits->next, undef, "hits exhausted" );

-$hits->fetch_hit;
-is( $hits->fetch_hit, undef, "hits exhausted" );
+$hits->next;
+is( $hits->next, undef, "hits exhausted" );

my @retrieved;
@retrieved = ();
@@ -34,13 +34,13 @@
num_wanted => 100,
);
is( $hits->total_hits, 3, "total_hits still correct" );
-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
push @retrieved, $hit->{content};
}
is_deeply(
\@retrieved,
[ @docs[ 2, 1, 0 ] ],
- "correct content via fetch_hit()"
+ "correct content via next()"
);

@retrieved = ();
@@ -50,7 +50,7 @@
num_wanted => 100,
);
is( $hits->total_hits, 3, "total_hits correct with offset" );
-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
push @retrieved, $hit->{content};
}
is( scalar @retrieved, 2, "number retrieved with offset" );

Modified: trunk/perl/t/510-remote_search.t
===================================================================
--- trunk/perl/t/510-remote_search.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/510-remote_search.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -121,8 +121,8 @@
is( $hits->total_hits, 2, "retrieved hits from MultiSearcher" );

my %results;
-$results{ $hits->fetch_hit()->{content} } = 1;
-$results{ $hits->fetch_hit()->{content} } = 1;
+$results{ $hits->next()->{content} } = 1;
+$results{ $hits->next()->{content} } = 1;
my %expected = ( 'x b' => 1, 'y b' => 1, );

is_deeply( \%results, \%expected, "docs fetched from both local and remote" );
@@ -136,7 +136,7 @@
);
my @got;

-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
push @got, $hit->{content};
}
$sort_spec = KinoSearch::Search::SortSpec->new();
@@ -146,7 +146,7 @@
sort_spec => $sort_spec,
);
my @reversed;
-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
push @reversed, $hit->{content};
}
is_deeply(

Modified: trunk/perl/t/511-sort_spec.t
===================================================================
--- trunk/perl/t/511-sort_spec.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/511-sort_spec.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -167,7 +167,7 @@
num_wanted => $num_wanted,
);
my @results;
- while ( my $hit = $hits->fetch_hit ) {
+ while ( my $hit = $hits->next ) {
push @results, $hit->{name};
}


Modified: trunk/perl/t/515-range_query.t
===================================================================
--- trunk/perl/t/515-range_query.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/515-range_query.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -290,7 +290,7 @@
num_wanted => 100,
);
my @results;
- while ( my $hit = $hits->fetch_hit ) {
+ while ( my $hit = $hits->next ) {
push @results, $hit->{name};
}


Modified: trunk/perl/t/525-match_all_query.t
===================================================================
--- trunk/perl/t/525-match_all_query.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/525-match_all_query.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -28,7 +28,7 @@
$hits = $searcher->search( query => $match_all_query, num_wanted => 100 );
is( $hits->total_hits, 25, "match all" );
my @got;
-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
push @got, $hit->{content};
}
is_deeply( \@got, [ 'a', 'c' .. 'z' ], "correct hits" );

Modified: trunk/perl/t/526-not_query.t
===================================================================
--- trunk/perl/t/526-not_query.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/526-not_query.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -41,7 +41,7 @@
);
is( $hits->total_hits, 25, "not b" );
@got = ();
-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
push @got, $hit->{content};
}
is_deeply( \@got, [ 'a', 'c' .. 'z' ], "correct hits" );
@@ -93,7 +93,7 @@
$searcher = KinoSearch::Searcher->new( invindex => $invindex );
$hits = $searcher->search( query => $not_b_query, num_wanted => 100 );
is( $hits->total_hits, 25, "still correct after deletion" );
-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
push @got, $hit->{content};
}
is_deeply( \@got, [ 'a', 'c' .. 'z' ], "correct hits after deletion" );

Modified: trunk/perl/t/602-boosts.t
===================================================================
--- trunk/perl/t/602-boosts.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/602-boosts.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -85,15 +85,15 @@

my $searcher = KinoSearch::Searcher->new( invindex => $control_invindex, );
my $hits = $searcher->search( query => 'a' );
-my $hit = $hits->fetch_hit;
+my $hit = $hits->next;
is( $hit->{content}, "x a a a a", "best doc ranks highest with no boosting" );

$searcher = KinoSearch::Searcher->new( invindex => $boosted_field_invindex, );
$hits = $searcher->search( query => 'a' );
-$hit = $hits->fetch_hit;
+$hit = $hits->next;
is( $hit->{content}, 'a b', "boost in Field spec works" );

$searcher = KinoSearch::Searcher->new( invindex => $boosted_doc_invindex, );
$hits = $searcher->search( query => 'a' );
-$hit = $hits->fetch_hit;
+$hit = $hits->next;
is( $hit->{content}, 'a b', "boost from \$doc->set_boost works" );

Modified: trunk/perl/t/603-query_boosts.t
===================================================================
--- trunk/perl/t/603-query_boosts.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/603-query_boosts.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -32,10 +32,10 @@
$combined_query->add_child($a_query);
$combined_query->add_child($x_y_query);
my $hits = $searcher->search( query => $combined_query );
-my $hit = $hits->fetch_hit;
+my $hit = $hits->next;
is( $hit->{content}, $doc_1, "best doc ranks highest with no boosting" );

$x_y_query->set_boost(2);
$hits = $searcher->search( query => $combined_query );
-$hit = $hits->fetch_hit;
+$hit = $hits->next;
is( $hit->{content}, $doc_2, "boosting a sub query succeeds" );

Modified: trunk/perl/t/605-store_pos_boost.t
===================================================================
--- trunk/perl/t/605-store_pos_boost.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/605-store_pos_boost.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -96,7 +96,7 @@
term => 'a',
);
my $hits = $searcher->search( query => $q_for_plain );
-is( $hits->fetch_hit->{plain},
+is( $hits->next->{plain},
$best, "verify that search on unboosted field returns best match" );

my $q_for_boosted = KinoSearch::Search::TermQuery->new(
@@ -104,7 +104,7 @@
term => 'a',
);
$hits = $searcher->search( query => $q_for_boosted );
-is( $hits->fetch_hit->{boosted},
+is( $hits->next->{boosted},
$boosted, "artificially boosted token overrides better match" );

__END__

Modified: trunk/perl/t/606-proximity.t
===================================================================
--- trunk/perl/t/606-proximity.t 2008-08-23 19:22:27 UTC (rev 3749)
+++ trunk/perl/t/606-proximity.t 2008-08-23 19:36:52 UTC (rev 3750)
@@ -17,7 +17,7 @@
my $hits = $searcher->search( query => 'a b c' );

my @contents;
-while ( my $hit = $hits->fetch_hit ) {
+while ( my $hit = $hits->next ) {
push @contents, $hit->{content};
}



_______________________________________________
kinosearch-commits mailing list
kinosearch-commits@rectangular.com
http://www.rectangular.com/mailman/listinfo/kinosearch-commits