my @attrs = param('attr');
my $op = param('attr_operator');
- if ( $search =~ m{(=|"|AND|OR)} ) {
+ if ( $search =~ m{(=|"|\bAND\b|\bOR\b)} ) {
push @search, $search;
} elsif ( @attrs ) {
$template =~ s{Q}{$v};
$whitespace = " AND " if $whitespace;
+ # don't return -* &* and other non-word characters
+ return '' if $template =~ m/^\W\*$/ || $template =~ m/\band\b/i;
+
return
$whitespace .
$attr . '="' . $template . '"';
$q .= ' AND ((' . join(') OR (', map { "input=\"$_\"" } @only_input) . '))' if @only_input;
warn "# query: $q\n";
- my $swish_results = $swish->query( $q );
+ my $search_obj = $swish->new_search_object;
+ if ( my $sort = param('sort') ) {
+ $search_obj->set_sort( $sort );
+ }
+ my $swish_results = $search_obj->execute( $q );
dump_yaml( 'swish_results', $swish_results );