warn "## attr_operator = ", dump( $attr_operator );
+my $only_input;
+
+foreach ( @{ $db->{input} } ) {
+ my $input = $_->{name} || die "no name in ",dump( $_ );
+ if ( ! $only_input->{'-labels'}->{$input} ) {
+ push @{ $only_input->{'-values'} }, $input;
+ $only_input->{'-labels'}->{$input} = $_->{description} || $input;
+ }
+}
+
+warn "## only_input = ", dump( $only_input );
+
print
start_html(
-title => $db->{name},
h2( 'Select input' ),
checkbox_group(
-name => 'only_input',
- -values => [ map { $_->{name} } @{ $db->{input} } ],
+ %$only_input,
-linebreak=> 'true',
),
qq|</div>|,
dump_yaml( 'pager', $pager );
- my @search = ();
-
+ my @search = ();
if ( $search =~ m{(=|"|AND|OR)} ) {
push @search, $search;
} elsif ( my $op = param('attr_operator') ) {
$v =~ s{(\s*)(\S+)}{rewrite($1,$2)}ge;
push @search, $v;
+
+ my @only_input = param('only_input');
+ push @search, '(' . join(') OR (', map { "input=$_" } @only_input) . ')' if @only_input;
} else {
push @search, "xml=$search";
}
- my @only_input = param('only_input');
-
- push @search, '(' . join(') or (', @only_input) . ')' if @only_input;
-
- my $q = '(' . join(') and (', @search) . ')';
+ my $q = '(' . join(') AND (', @search) . ')';
$q =~ s{\(\((.+)\)\)}{($1)};
warn "# query: $q\n";
my $swish_results = $swish->query( $q );