Changeset 43 for server/trunk/web/lib/Sophie/Controller/Search.pm
- Timestamp:
- 11/28/10 19:30:07 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/trunk/web/lib/Sophie/Controller/Search.pm
r40 r43 23 23 =cut 24 24 25 my $search_param = {26 rows => Sophie->config()->{'max_reply'} || 20000,27 order_by => [ 'name', 'evr using >>', 'issrc' ],28 select => [ 'pkgid' ],29 };30 31 25 sub index :Path :Args(0) { 32 26 my ( $self, $c ) = @_; 33 27 34 $c->response->body('Matched Sophie::Controller::Search in Search.'); 28 if ($c->req->param('page')) { 29 $c->req->params->{search} = $c->session->{search}; 30 } 31 32 if ($c->req->param('search')) { 33 $c->session->{search} = $c->req->param('search'); 34 $c->forward('fuzzy', [ undef, $c->req->param('search') ]); 35 my $pager = $c->stash->{rs}->pager; 36 $c->stash->{pager} = $pager; 37 $c->stash->{xmlrpc} = [ 38 $c->stash->{rs}->get_column('pkgid')->all 39 ]; 40 } 41 } 42 43 sub search_param : Private { 44 my ($self, $c) = @_; 45 my $r = { 46 rows => Sophie->config()->{'max_reply'} || 20000, 47 order_by => [ 'name', 'evr using >>', 'issrc' ], 48 select => [ 'pkgid' ], 49 }; 50 if (!$c->req->xmlrpc->method) { 51 $r->{page} = $c->req->param('page') || 1; 52 $r->{rows} = 25; 53 } 54 return $r; 35 55 } 36 56 … … 48 68 { 49 69 $searchspec->{release} 50 ? ( release=> $searchspec->{release})70 ? (version => $searchspec->{release}) 51 71 : () 52 72 } … … 84 104 ] 85 105 }, 86 $ search_param,106 $c->forward('search_param'), 87 107 )->get_column('pkgid')->all ] 88 108 … … 120 140 ] 121 141 }, 122 $ search_param,142 $c->forward('search_param'), 123 143 )->get_column('pkgid')->all ] 124 144 } … … 151 171 ] 152 172 }, 153 $ search_param,173 $c->forward('search_param'), 154 174 )->get_column('pkgid')->all ] 155 175 } … … 165 185 )->get_column('pkgid'); 166 186 167 $c->stash->{xmlrpc} = [ $c->model('Base')->resultset('Rpms')->search( 187 $c->stash->{rs} = 188 189 $c->model('Base')->resultset('Rpms')->search( 168 190 { 169 191 -and => [ … … 185 207 ] 186 208 }, 187 $search_param, 188 )->get_column('pkgid')->all ] 209 $c->forward('search_param'), 210 ); 211 212 if ($c->req->xmlrpc->method) { 213 $c->stash->{xmlrpc} = [ 214 $c->stash->{rs}->get_column('pkgid')->all 215 ]; 216 } 189 217 } 190 218 … … 208 236 }, 209 237 { 210 % $search_param,238 %{$c->forward('search_param')}, 211 239 select => [ 212 240 "ts_rank_cd(to_tsvector('english', description),to_tsquery(?)) as rank",
Note: See TracChangeset
for help on using the changeset viewer.