--- Webpacus/lib/Webpacus/Controller/Search.pm 2005/12/16 21:09:48 269 +++ Webpacus/lib/Webpacus/Controller/Search.pm 2005/12/17 00:37:12 270 @@ -32,6 +32,9 @@ sub default : Private { my ( $self, $c ) = @_; + + $c->log->debug("default search got param: ".Dumper($c->req->params)); + $c->stash->{template} = 'search.tt'; } @@ -88,21 +91,46 @@ } -# specify all Hyper Estraier operators which should stop this module -# from splitting search query and joining it with default operator -my $hest_op_regex = qr/(:?\[(:?BW|EW|RX)\]|AND|OR|ANDNOT)/; - =item results -Method which uses C and returns results for search query +Returns results for search query =cut sub results : Local { my ( $self, $c ) = @_; - my $webpac = $c->comp('Model::WebPAC'); my $params = $c->req->params; + + # oh, client didn't have ability to setup AJAX, fallback to + # page refresh + if (! $params->{'_ajax'}) { + $params->{_ajax} = 1; + $c->stash->{results} = $c->subreq('/search/results/ajax', {}, $params); + $c->stash->{template} = 'search.tt'; + } else { + $c->forward('/search/results/ajax'); + } +} + + +=item results_ajax + +Private method which uses C and returns results for search +query It generatets just I HTML for results div, so it has C<_ajax> +in name. + +=cut + +# specify all Hyper Estraier operators which should stop this module +# from splitting search query and joining it with default operator +my $hest_op_regex = qr/(:?\[(:?BW|EW|RX)\]|AND|OR|ANDNOT)/o; + +sub results_ajax : Path( 'results/ajax' ) { + my ( $self, $c ) = @_; + + my $params = $c->req->params; + my $webpac = $c->comp('Model::WebPAC'); my $log = $c->log; $log->debug("results got params: " . Dumper( $params ) ); @@ -175,6 +203,7 @@ $c->stash->{hits_on_page} = $hits_on_page; $c->stash->{template} = 'results.tt'; + } =item record