|
Lines 227-234
sub build_query_compat {
Link Here
|
| 227 |
# would be to pass them separately into build_query and let it build |
227 |
# would be to pass them separately into build_query and let it build |
| 228 |
# them into a structured ES query itself. Maybe later, though that'd be |
228 |
# them into a structured ES query itself. Maybe later, though that'd be |
| 229 |
# more robust. |
229 |
# more robust. |
|
|
230 |
my $search_param_query_str = join( ' ', $self->_create_query_string(@search_params) ); |
| 230 |
my $query_str = join( ' AND ', |
231 |
my $query_str = join( ' AND ', |
| 231 |
join( ' ', $self->_create_query_string(@search_params) ) || (), |
232 |
$search_param_query_str || (), |
| 232 |
$self->_join_queries( $self->_convert_index_strings(@$limits) ) || () ); |
233 |
$self->_join_queries( $self->_convert_index_strings(@$limits) ) || () ); |
| 233 |
|
234 |
|
| 234 |
my @fields = '_all'; |
235 |
my @fields = '_all'; |
|
Lines 244-262
sub build_query_compat {
Link Here
|
| 244 |
$options{expanded_facet} = $params->{expanded_facet}; |
245 |
$options{expanded_facet} = $params->{expanded_facet}; |
| 245 |
my $query = $self->build_query( $query_str, %options ); |
246 |
my $query = $self->build_query( $query_str, %options ); |
| 246 |
|
247 |
|
| 247 |
#die Dumper($query); |
|
|
| 248 |
# We roughly emulate the CGI parameters of the zebra query builder |
248 |
# We roughly emulate the CGI parameters of the zebra query builder |
| 249 |
my $query_cgi; |
249 |
my $query_cgi = ''; |
| 250 |
$query_cgi = 'q=' . uri_escape_utf8( $operands->[0] ) if @$operands; |
250 |
shift @$operators; # Shift out the one we unshifted before |
|
|
251 |
$ea = each_array( @$operands, @$operators, @$indexes ); |
| 252 |
while ( my ( $oand, $otor, $index ) = $ea->() ) { |
| 253 |
$query_cgi .= '&' if $query_cgi; |
| 254 |
$query_cgi .= 'idx=' . uri_escape_utf8( $index // '') . '&q=' . uri_escape_utf8( $oand ); |
| 255 |
$query_cgi .= '&op=' . uri_escape_utf8( $otor ) if $otor; |
| 256 |
} |
| 257 |
$query_cgi .= '&scan=1' if ( $scan ); |
| 258 |
|
| 251 |
my $simple_query; |
259 |
my $simple_query; |
| 252 |
$simple_query = $operands->[0] if @$operands == 1; |
260 |
$simple_query = $operands->[0] if @$operands == 1; |
| 253 |
my $query_desc = $simple_query; |
261 |
my $query_desc; |
| 254 |
my $limit = $self->_join_queries( $self->_convert_index_strings(@$limits)); |
262 |
if ( $simple_query ) { |
|
|
263 |
$query_desc = $simple_query; |
| 264 |
} else { |
| 265 |
$query_desc = $search_param_query_str; |
| 266 |
} |
| 267 |
my $limit = $self->_join_queries( $self->_convert_index_strings(@$limits)); |
| 255 |
my $limit_cgi = ( $orig_limits and @$orig_limits ) |
268 |
my $limit_cgi = ( $orig_limits and @$orig_limits ) |
| 256 |
? '&limit=' . join( '&limit=', map { uri_escape_utf8($_) } @$orig_limits ) |
269 |
? '&limit=' . join( '&limit=', map { uri_escape_utf8($_) } @$orig_limits ) |
| 257 |
: ''; |
270 |
: ''; |
| 258 |
my $limit_desc; |
271 |
my $limit_desc; |
| 259 |
$limit_desc = "$limit" if $limit; |
272 |
$limit_desc = "$limit" if $limit; |
|
|
273 |
|
| 260 |
return ( |
274 |
return ( |
| 261 |
undef, $query, $simple_query, $query_cgi, $query_desc, |
275 |
undef, $query, $simple_query, $query_cgi, $query_desc, |
| 262 |
$limit, $limit_cgi, $limit_desc, undef, undef |
276 |
$limit, $limit_cgi, $limit_desc, undef, undef |