my $nres;
while ($nres = $est->search($cond,0) and $nres->doc_num > 0){
for my $rdoc (map {$nres->get_doc($_)} 0..($nres->doc_num-1)) {
my $nres;
while ($nres = $est->search($cond,0) and $nres->doc_num > 0){
for my $rdoc (map {$nres->get_doc($_)} 0..($nres->doc_num-1)) {