--- trunk/vhost/webpac2.cgi 2009/04/25 11:00:22 1155 +++ trunk/vhost/webpac2.cgi 2009/04/25 11:58:23 1157 @@ -116,6 +116,18 @@ 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}, @@ -139,7 +151,7 @@ h2( 'Select input' ), checkbox_group( -name => 'only_input', - -values => [ map { $_->{name} } @{ $db->{input} } ], + %$only_input, -linebreak=> 'true', ), qq||, @@ -165,8 +177,7 @@ dump_yaml( 'pager', $pager ); - my @search = (); - + my @search = (); if ( $search =~ m{(=|"|AND|OR)} ) { push @search, $search; } elsif ( my $op = param('attr_operator') ) { @@ -189,15 +200,14 @@ $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 );