- $cond->add_attr("backup_date NUMGE $backup_from") if ($backup_from);
- $cond->add_attr("backup_date NUMLE $backup_to") if ($backup_to);
-
- $cond->add_attr("date NUMGE $files_from") if ($files_from);
- $cond->add_attr("date NUMLE $files_to") if ($files_to);
-
- $cond->add_attr("shareid NUMEQ $shareid") if ($shareid);
-
- $cond->set_max( $offset + $on_page );
- $cond->set_options( 'SURE' );
- $cond->set_order( getSort('search', 'est', $param->{'sort'} ) );
-
- # get the result of search
- my @res;
- my ($result, $hits);
-
- if ($hest_node_url) {
- $result = $db->search($cond, 0);
- if ($result) {
- $hits = $result->hits;
- } else {
- $hits = 0;
- return ($hits,[]);
- }
- } else {
- die "BUG: unimplemented";
- }
-
- # for each document in result
- for my $i ($offset .. ($offset + $on_page - 1)) {
- last if ($i >= $result->doc_num);
-
- my $doc;
- if ($hest_node_url) {
- $doc = $result->get_doc($i);
- } else {
- die "BUG: unimplemented";
- }
-
- my $row;
- foreach my $c (qw/fid hname sname backupnum filepath date type size/) {
- $row->{$c} = $doc->attr($c);
- }
- push @res, $row;
- }
-
- return ($hits, \@res);
+ return BackupPC::Search::Estraier->new( $hest_node_url )->search(
+ $offset, $on_page, $param->{sort},
+ $q, $shareid, $backup_from, $backup_to, $files_from, $files_to
+ );
+