[Catalyst-commits] r6365 - in trunk/Catalyst-Model-Xapian: .
lib/Catalyst/Model lib/Catalyst/Model/Xapian
marcus at dev.catalyst.perl.org
marcus at dev.catalyst.perl.org
Sun May 6 17:30:37 GMT 2007
Author: marcus
Date: 2007-05-06 17:30:37 +0100 (Sun, 06 May 2007)
New Revision: 6365
Modified:
trunk/Catalyst-Model-Xapian/MANIFEST
trunk/Catalyst-Model-Xapian/lib/Catalyst/Model/Xapian.pm
trunk/Catalyst-Model-Xapian/lib/Catalyst/Model/Xapian/Result.pm
Log:
- Add support for modifying Enquire object in model.
Modified: trunk/Catalyst-Model-Xapian/MANIFEST
===================================================================
--- trunk/Catalyst-Model-Xapian/MANIFEST 2007-05-06 15:41:24 UTC (rev 6364)
+++ trunk/Catalyst-Model-Xapian/MANIFEST 2007-05-06 16:30:37 UTC (rev 6365)
@@ -1,7 +1,7 @@
Build.PL
-Changes
lib/Catalyst/Helper/Model/Xapian.pm
lib/Catalyst/Model/Xapian.pm
+lib/Catalyst/Model/Xapian/Result.pm
Makefile.PL
MANIFEST This list of files
META.yml
Modified: trunk/Catalyst-Model-Xapian/lib/Catalyst/Model/Xapian/Result.pm
===================================================================
--- trunk/Catalyst-Model-Xapian/lib/Catalyst/Model/Xapian/Result.pm 2007-05-06 15:41:24 UTC (rev 6364)
+++ trunk/Catalyst-Model-Xapian/lib/Catalyst/Model/Xapian/Result.pm 2007-05-06 16:30:37 UTC (rev 6365)
@@ -19,7 +19,7 @@
$pager->entries_per_page( $self->page_size );
$pager->current_page( $self->page );
$self->pager( $pager );
- $self;
+ return $self;
}
sub hits {
Modified: trunk/Catalyst-Model-Xapian/lib/Catalyst/Model/Xapian.pm
===================================================================
--- trunk/Catalyst-Model-Xapian/lib/Catalyst/Model/Xapian.pm 2007-05-06 15:41:24 UTC (rev 6364)
+++ trunk/Catalyst-Model-Xapian/lib/Catalyst/Model/Xapian.pm 2007-05-06 16:30:37 UTC (rev 6365)
@@ -124,14 +124,16 @@
=cut
+
sub search {
my ( $class,$q, $page,$page_size) = @_;
my $t=[gettimeofday];
$page ||= 1;
$page_size ||= $class->config->{page_size};
$class->db->reopen();
- my $query=$class->qp->parse_query( $q );
+ my $query=$class->qp->parse_query( $q, 23 );
my $enq = $class->db->enquire ( $query );
+ $class->prepare_enq($enq);
if( $class->config->{order_by_date} ) {
$enq->set_docid_order(ENQ_DESCENDING);
$enq->set_weighting_scheme(Search::Xapian::BoolWeight->new());
@@ -146,6 +148,15 @@
search=>$class,query=>$q,query_obj=>$query,querytime=>$time,page=>$page,page_size=>$page_size });
}
+=item prepare_enq <enq>
+
+Prepare enquire object before getting mset. Allows you to modify
+ordering and such in your subclass.
+
+=cut
+
+sub prepare_enq {}
+
=item extract_data <item> <query>
Extract data from a L<Search::Xapian::Document>. Defaults to
@@ -161,6 +172,10 @@
1;
+=item qp
+
+Query Parser. The L<Search::Xapian::QueryParser> object used to parse the query.
+
=back
=head1 AUTHOR
More information about the Catalyst-commits
mailing list