95 |
index |
index |
96 |
) ); |
) ); |
97 |
|
|
98 |
|
use lib '/data/webpac2/lib'; |
99 |
|
use WebPAC::Store; |
100 |
|
|
101 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
102 |
|
|
103 |
|
my $debug = 1; |
104 |
|
|
105 |
|
my $store; |
106 |
|
|
107 |
sub next { |
sub next { |
108 |
my $self = shift; |
my $self = shift; |
|
my $row = $self->index->fetch_hit_hashref; |
|
109 |
|
|
110 |
warn "## next row = ", dump( $row ); |
if ( ! $store ) { |
111 |
|
$store = WebPAC::Store->new({ |
112 |
|
debug => $debug, |
113 |
|
}); |
114 |
|
warn "## create WebPAC::Store\n"; |
115 |
|
} |
116 |
|
|
117 |
|
my $hit = $self->index->fetch_hit_hashref; |
118 |
|
|
119 |
|
return unless $hit; |
120 |
|
|
121 |
|
warn "## next hit = ", dump( $hit ) if $debug; |
122 |
|
|
123 |
|
my $ds = $store->load_ds( |
124 |
|
database => $hit->{database}, |
125 |
|
input => $hit->{input}, |
126 |
|
id => $hit->{id}, |
127 |
|
); |
128 |
|
|
129 |
|
if ( ! $ds ) { |
130 |
|
warn "can't find ds for hit ", dump( $hit ), $/ unless $ds; |
131 |
|
return; |
132 |
|
} |
133 |
|
|
134 |
|
my $row; |
135 |
|
|
136 |
|
foreach my $f ( keys %$ds ) { |
137 |
|
$row->{$f} = $ds->{$f}->{display} if defined $ds->{$f}->{display}; |
138 |
|
} |
139 |
|
|
140 |
|
return unless $row; |
141 |
|
|
142 |
|
$row->{$_} ||= $hit->{$_} foreach ( qw/database input id/ ); |
143 |
|
|
144 |
|
warn "## next row = ", dump( $row ) if $debug; |
145 |
|
|
146 |
return $row; |
return $row; |
147 |
} |
} |