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/07 18:30:33 UTC
[lucy-commits] svn commit: r1032323 - in /incubator/lucy/trunk/perl:
lib/Lucy/Docs/Cookbook/CustomQueryParser.pod
lib/Lucy/Docs/Tutorial/BeyondSimple.pod
lib/Lucy/Docs/Tutorial/QueryObjects.pod lib/Lucy/Docs/Tutorial/Simple.pod
sample/search.cgi
Author: marvin
Date: Sun Nov 7 17:30:33 2010
New Revision: 1032323
URL: http://svn.apache.org/viewvc?rev=1032323&view=rev
Log:
Rename a variable in the Tutorial/sample (hits_per_page -> page_size).
Modified:
incubator/lucy/trunk/perl/lib/Lucy/Docs/Cookbook/CustomQueryParser.pod
incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/BeyondSimple.pod
incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/QueryObjects.pod
incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/Simple.pod
incubator/lucy/trunk/perl/sample/search.cgi
Modified: incubator/lucy/trunk/perl/lib/Lucy/Docs/Cookbook/CustomQueryParser.pod
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/lib/Lucy/Docs/Cookbook/CustomQueryParser.pod?rev=1032323&r1=1032322&r2=1032323&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/lib/Lucy/Docs/Cookbook/CustomQueryParser.pod (original)
+++ incubator/lucy/trunk/perl/lib/Lucy/Docs/Cookbook/CustomQueryParser.pod Sun Nov 7 17:30:33 2010
@@ -348,7 +348,7 @@ for how they behave:
my $hits = $searcher->hits(
query => $query,
offset => $offset,
- num_wanted => $hits_per_page,
+ num_wanted => $page_size,
);
...
Modified: incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/BeyondSimple.pod
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/BeyondSimple.pod?rev=1032323&r1=1032322&r2=1032323&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/BeyondSimple.pod (original)
+++ incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/BeyondSimple.pod Sun Nov 7 17:30:33 2010
@@ -132,7 +132,7 @@ also straightforward:
my $hits = $searcher->hits( # returns a Hits object, not a hit count
query => $q,
offset => $offset,
- num_wanted => $hits_per_page,
+ num_wanted => $page_size,
);
my $hit_count = $hits->total_hits; # get the hit count here
Modified: incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/QueryObjects.pod
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/QueryObjects.pod?rev=1032323&r1=1032322&r2=1032323&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/QueryObjects.pod (original)
+++ incubator/lucy/trunk/perl/lib/Lucy/Docs/Tutorial/QueryObjects.pod Sun Nov 7 17:30:33 2010
@@ -136,7 +136,7 @@ Now when we execute the query...
my $hits = $searcher->hits(
query => $query,
offset => $offset,
- num_wanted => $hits_per_page,
+ num_wanted => $page_size,
);
... we'll get a result set which is the intersection of the parsed query and
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=1032323&r1=1032322&r2=1032323&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 7 17:30:33 2010
@@ -115,10 +115,10 @@ The beginning is dedicated to CGI proces
use Data::Pageset;
use LucyX::Simple;
- my $cgi = CGI->new;
- my $q = decode( "UTF-8", $cgi->param('q') || '' );
- my $offset = decode( "UTF-8", $cgi->param('offset') || 0 );
- my $hits_per_page = 10;
+ my $cgi = CGI->new;
+ my $q = decode( "UTF-8", $cgi->param('q') || '' );
+ my $offset = decode( "UTF-8", $cgi->param('offset') || 0 );
+ my $page_size = 10;
Once that's out of the way, we create our LucyX::Simple object and feed
it a query string.
@@ -130,7 +130,7 @@ it a query string.
my $hit_count = $simple->search(
query => $q,
offset => $offset,
- num_wanted => $hits_per_page,
+ num_wanted => $page_size,
);
The value returned by search() is the total number of documents in the
@@ -181,10 +181,10 @@ The rest of the script is just text wran
= qq|<p>No matches for <strong>$escaped_q</strong></p>|;
}
else {
- my $current_page = ( $offset / $hits_per_page ) + 1;
+ my $current_page = ( $offset / $page_size ) + 1;
my $pager = Data::Pageset->new(
{ total_entries => $total_hits,
- entries_per_page => $hits_per_page,
+ entries_per_page => $page_size,
current_page => $current_page,
pages_per_set => 10,
mode => 'slide',
@@ -212,7 +212,7 @@ The rest of the script is just text wran
# Generate the "Prev" link.
if ( $current_page > 1 ) {
- my $new_offset = ( $current_page - 2 ) * $hits_per_page;
+ my $new_offset = ( $current_page - 2 ) * $page_size;
$href =~ s/(?<=offset=)\d+/$new_offset/;
$paging_info .= qq|<a href="$href"><= Prev</a>\n|;
}
@@ -223,7 +223,7 @@ The rest of the script is just text wran
$paging_info .= qq|$page_num \n|;
}
else {
- my $new_offset = ( $page_num - 1 ) * $hits_per_page;
+ my $new_offset = ( $page_num - 1 ) * $page_size;
$href =~ s/(?<=offset=)\d+/$new_offset/;
$paging_info .= qq|<a href="$href">$page_num</a>\n|;
}
@@ -231,7 +231,7 @@ The rest of the script is just text wran
# Generate the "Next" link.
if ( $current_page != $pager->last_page ) {
- my $new_offset = $current_page * $hits_per_page;
+ my $new_offset = $current_page * $page_size;
$href =~ s/(?<=offset=)\d+/$new_offset/;
$paging_info .= qq|<a href="$href">Next =></a>\n|;
}
Modified: incubator/lucy/trunk/perl/sample/search.cgi
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/sample/search.cgi?rev=1032323&r1=1032322&r2=1032323&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/sample/search.cgi (original)
+++ incubator/lucy/trunk/perl/sample/search.cgi Sun Nov 7 17:30:33 2010
@@ -30,11 +30,11 @@ use Lucy::Search::QueryParser;
use Lucy::Search::TermQuery;
use Lucy::Search::ANDQuery;
-my $cgi = CGI->new;
-my $q = decode( "UTF-8", $cgi->param('q') || '' );
-my $offset = decode( "UTF-8", $cgi->param('offset') || 0 );
-my $category = decode( "UTF-8", $cgi->param('category') || '' );
-my $hits_per_page = 10;
+my $cgi = CGI->new;
+my $q = decode( "UTF-8", $cgi->param('q') || '' );
+my $offset = decode( "UTF-8", $cgi->param('offset') || 0 );
+my $category = decode( "UTF-8", $cgi->param('category') || '' );
+my $page_size = 10;
# Create an IndexSearcher and a QueryParser.
my $searcher = Lucy::Search::IndexSearcher->new(
@@ -60,7 +60,7 @@ if ($category) {
my $hits = $searcher->hits(
query => $query,
offset => $offset,
- num_wanted => $hits_per_page,
+ num_wanted => $page_size,
);
my $hit_count = $hits->total_hits;
@@ -112,10 +112,10 @@ sub generate_paging_info {
= qq|<p>No matches for <strong>$escaped_q</strong></p>|;
}
else {
- my $current_page = ( $offset / $hits_per_page ) + 1;
+ my $current_page = ( $offset / $page_size ) + 1;
my $pager = Data::Pageset->new(
{ total_entries => $total_hits,
- entries_per_page => $hits_per_page,
+ entries_per_page => $page_size,
current_page => $current_page,
pages_per_set => 10,
mode => 'slide',
@@ -143,7 +143,7 @@ sub generate_paging_info {
# Generate the "Prev" link.
if ( $current_page > 1 ) {
- my $new_offset = ( $current_page - 2 ) * $hits_per_page;
+ my $new_offset = ( $current_page - 2 ) * $page_size;
$href =~ s/(?<=offset=)\d+/$new_offset/;
$paging_info .= qq|<a href="$href"><= Prev</a>\n|;
}
@@ -154,7 +154,7 @@ sub generate_paging_info {
$paging_info .= qq|$page_num \n|;
}
else {
- my $new_offset = ( $page_num - 1 ) * $hits_per_page;
+ my $new_offset = ( $page_num - 1 ) * $page_size;
$href =~ s/(?<=offset=)\d+/$new_offset/;
$paging_info .= qq|<a href="$href">$page_num</a>\n|;
}
@@ -162,7 +162,7 @@ sub generate_paging_info {
# Generate the "Next" link.
if ( $current_page != $pager->last_page ) {
- my $new_offset = $current_page * $hits_per_page;
+ my $new_offset = $current_page * $page_size;
$href =~ s/(?<=offset=)\d+/$new_offset/;
$paging_info .= qq|<a href="$href">Next =></a>\n|;
}