125 |
|
|
126 |
my $log = $self->_get_logger; |
my $log = $self->_get_logger; |
127 |
|
|
128 |
|
#$log->debug( 'search args: ' . Dumper($args) ); |
129 |
|
|
130 |
$self->confess('need db in object') unless ($self->{db}); |
$self->confess('need db in object') unless ($self->{db}); |
131 |
$self->confess('need get_attr') unless ($args->{get_attr}); |
$self->confess('need get_attr') unless ($args->{get_attr}); |
132 |
|
|
134 |
|
|
135 |
my $q = $args->{phrase}; |
my $q = $args->{phrase}; |
136 |
|
|
137 |
|
$log->debug("args: " . Dumper( $args )); |
138 |
|
|
139 |
my $cond = HyperEstraier::Condition->new(); |
my $cond = HyperEstraier::Condition->new(); |
140 |
if ( ref($args->{add_attr}) eq 'ARRAY' ) { |
if ( ref($args->{add_attr}) eq 'ARRAY' ) { |
141 |
$log->debug("adding search attributes: " . join(", ", @{ $args->{add_attr} }) ); |
$log->debug("adding search attributes: " . join(", ", @{ $args->{add_attr} }) ); |
142 |
map { |
map { |
143 |
$cond->add_attr( $self->{iconv}->conver( $_ ) ); |
$cond->add_attr( $self->{iconv}->convert( $_ ) ); |
144 |
$log->debug(" + $_"); |
$log->debug(" + $_"); |
145 |
} $args->{add_attr}; |
} @{ $args->{add_attr} }; |
146 |
} |
}; |
147 |
|
|
148 |
$cond->set_phrase( $self->{iconv}->convert($q) ) if ($q); |
$cond->set_phrase( $self->{iconv}->convert($q) ) if ($q); |
149 |
$cond->set_max( $args->{max} ) if ($args->{max}); |
$cond->set_max( $args->{max} ) if ($args->{max}); |