You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2010/11/14 07:25:29 UTC
[lucy-commits] svn commit: r1034940 - in /incubator/lucy/trunk/perl:
buildlib/Lucy/Test/TestUtils.pm lib/Lucy/Docs/Tutorial/Simple.pod
sample/search.cgi
Author: marvin
Date: Sun Nov 14 06:25:28 2010
New Revision: 1034940
URL: http://svn.apache.org/viewvc?rev=1034940&view=rev
Log:
Fix broken variable name in sample/tutorial search code. Adapt test suite for
text version of sample corpus (missing from earlier commit).
Modified:
incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm
incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/Simple.pod
incubator/lucy/trunk/perl/sample/search.cgi
Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm?rev=1034940&r1=1034939&r2=1034940&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Test/TestUtils.pm Sun Nov 14 06:25:28 2010
@@ -117,13 +117,10 @@ sub get_uscon_docs {
open( my $fh, '<', $filepath )
or die "couldn't open file '$filepath': $!";
my $content = do { local $/; <$fh> };
- $content =~ m#<title>(.*?)</title>#s
- or die "couldn't isolate title in '$filepath'";
- my $title = $1;
- $content =~ m#<div id="bodytext">(.*?)</div><!--bodytext-->#s
- or die "couldn't isolate bodytext in '$filepath'";
- my $bodytext = $1;
- $bodytext =~ s/<.*?>//sg;
+ $content =~ /(.*?)\n\n(.*)/s
+ or die "Can't extract title/bodytext from '$filepath'";
+ my $title = $1;
+ my $bodytext = $2;
$bodytext =~ s/\s+/ /sg;
my $category
= $filename =~ /art/ ? 'article'
Modified: incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/Simple.pod
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/Simple.pod?rev=1034940&r1=1034939&r2=1034940&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/Simple.pod (original)
+++ incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/Simple.pod Sun Nov 14 06:25:28 2010
@@ -175,7 +175,7 @@ The rest of the script is just text wran
}
else {
# Calculate the nums for the first and last hit to display.
- my $last_result = min( ( $offset + $hits_per_page ), $total_hits );
+ my $last_result = min( ( $offset + $page_size ), $total_hits );
my $first_result = min( ( $offset + 1 ), $last_result );
# Display the result nums, start paging info.
@@ -190,8 +190,8 @@ The rest of the script is just text wran
|;
# Calculate first and last hits pages to display / link to.
- my $current_page = int( $first_result / $hits_per_page ) + 1;
- my $last_page = ceil( $total_hits / $hits_per_page );
+ my $current_page = int( $first_result / $page_size ) + 1;
+ my $last_page = ceil( $total_hits / $page_size );
my $first_page = max( 1, ( $current_page - 9 ) );
$last_page = min( $last_page, ( $current_page + 10 ) );
Modified: incubator/lucy/trunk/perl/sample/search.cgi
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/sample/search.cgi?rev=1034940&r1=1034939&r2=1034940&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/sample/search.cgi (original)
+++ incubator/lucy/trunk/perl/sample/search.cgi Sun Nov 14 06:25:28 2010
@@ -114,7 +114,7 @@ sub generate_paging_info {
}
else {
# Calculate the nums for the first and last hit to display.
- my $last_result = min( ( $offset + $hits_per_page ), $total_hits );
+ my $last_result = min( ( $offset + $page_size ), $total_hits );
my $first_result = min( ( $offset + 1 ), $last_result );
# Display the result nums, start paging info.
@@ -129,8 +129,8 @@ sub generate_paging_info {
|;
# Calculate first and last hits pages to display / link to.
- my $current_page = int( $first_result / $hits_per_page ) + 1;
- my $last_page = ceil( $total_hits / $hits_per_page );
+ my $current_page = int( $first_result / $page_size ) + 1;
+ my $last_page = ceil( $total_hits / $page_size );
my $first_page = max( 1, ( $current_page - 9 ) );
$last_page = min( $last_page, ( $current_page + 10 ) );