32 |
|
|
33 |
sub default : Private { |
sub default : Private { |
34 |
my ( $self, $c ) = @_; |
my ( $self, $c ) = @_; |
35 |
|
|
36 |
|
$c->log->debug("default search got param: ".Dumper($c->req->params)); |
37 |
|
|
38 |
$c->stash->{template} = 'search.tt'; |
$c->stash->{template} = 'search.tt'; |
39 |
} |
} |
40 |
|
|
58 |
my $webpac = $c->comp('Model::WebPAC'); |
my $webpac = $c->comp('Model::WebPAC'); |
59 |
|
|
60 |
my $q = $c->req->params->{$what} || |
my $q = $c->req->params->{$what} || |
61 |
$c->req->params->{all} || $c->res->output("no results"); |
$c->req->params->{all} || $c->response->body("no results"); |
62 |
|
|
63 |
|
|
64 |
$log->info("search for '$q' in $what\n"); |
$log->info("search for '$q' in $what\n"); |
91 |
} |
} |
92 |
|
|
93 |
|
|
|
# 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)/; |
|
|
|
|
94 |
=item results |
=item results |
95 |
|
|
96 |
Method which uses C<Model::WebPAC> and returns results for search query |
Returns results for search query |
97 |
|
|
98 |
=cut |
=cut |
99 |
|
|
100 |
sub results : Local { |
sub results : Local { |
101 |
my ( $self, $c ) = @_; |
my ( $self, $c ) = @_; |
102 |
|
|
|
my $webpac = $c->comp('Model::WebPAC'); |
|
103 |
my $params = $c->req->params; |
my $params = $c->req->params; |
104 |
|
|
105 |
|
# do full-page refresh for clients without JavaScript |
106 |
|
$c->stash->{results} = $c->subreq('/search/results/ajax', {}, $params); |
107 |
|
$c->stash->{template} = 'search.tt'; |
108 |
|
} |
109 |
|
|
110 |
|
|
111 |
|
=item results_ajax |
112 |
|
|
113 |
|
Private method which uses C<Model::WebPAC> and returns results for search |
114 |
|
query It generatets just I<inner> HTML for results div, so it has C<_ajax> |
115 |
|
in name. |
116 |
|
|
117 |
|
=cut |
118 |
|
|
119 |
|
# specify all Hyper Estraier operators which should stop this module |
120 |
|
# from splitting search query and joining it with default operator |
121 |
|
my $hest_op_regex = qr/(:?\[(:?BW|EW|RX)\]|AND|OR|ANDNOT)/o; |
122 |
|
|
123 |
|
sub results_ajax : Path( 'results/ajax' ) { |
124 |
|
my ( $self, $c ) = @_; |
125 |
|
|
126 |
|
my $params = $c->req->params; |
127 |
|
my $webpac = $c->comp('Model::WebPAC'); |
128 |
my $log = $c->log; |
my $log = $c->log; |
129 |
|
|
130 |
$log->debug("results got params: " . Dumper( $params ) ); |
$log->debug("results got params: " . Dumper( $params ) ); |
168 |
} |
} |
169 |
} |
} |
170 |
|
|
171 |
|
if ($params->{_database}) { |
172 |
|
my $type = $c->config->{hyperstraier}->{type} || 'search'; |
173 |
|
my $attr; |
174 |
|
if (ref($params->{_database}) eq 'ARRAY') { |
175 |
|
# FIXME do we need to add $ at end? |
176 |
|
$attr .= '(' . join("|",@{$params->{_database}}) . ')'; |
177 |
|
} else { |
178 |
|
$attr .= $params->{_database}; |
179 |
|
} |
180 |
|
push @attr, '@uri STRRX /' . $type . '/' . $attr . '/'; |
181 |
|
} |
182 |
|
|
183 |
my $q = join(" $operator ", @words); |
my $q = join(" $operator ", @words); |
184 |
|
|
185 |
my $template = $params->{'_template'} || $c->config->{webpac}->{template}; |
my $template = $params->{'_template'} || $c->config->{webpac}->{template}; |
209 |
$c->stash->{hits_on_page} = $hits_on_page; |
$c->stash->{hits_on_page} = $hits_on_page; |
210 |
|
|
211 |
$c->stash->{template} = 'results.tt'; |
$c->stash->{template} = 'results.tt'; |
212 |
|
|
213 |
} |
} |
214 |
|
|
215 |
=item record |
=item record |