1 | #! perl # mandatory |
1 | #! perl # mandatory |
2 | |
2 | |
3 | our $SCHEDULE_INTERVAL = $cf::CFG{extractor_schedule_interval} || 3600; |
3 | our $SCHEDULE_INTERVAL = $cf::CFG{extractor_schedule_interval} || 3600; |
4 | |
4 | |
5 | use JSON::XS; |
5 | use JSON::XS; |
6 | |
6 | |
7 | my $db_mapinfo = cf::sync_job { cf::db_table "tag-mapinfo" }; # info/cache for maps |
7 | my $db_mapinfo = cf::sync_job { cf::db_table "tag-mapinfo" }; # info/cache for maps |
8 | my $db_target = cf::sync_job { cf::db_table "tag-target" }; # tag => maps |
8 | my $db_target = cf::sync_job { cf::db_table "tag-target" }; # tag => maps |
… | |
… | |
149 | warn sprintf "map-tag scan (%fs)", Event::time - $start; |
149 | warn sprintf "map-tag scan (%fs)", Event::time - $start; |
150 | Coro::Timer::sleep $SCHEDULE_INTERVAL; |
150 | Coro::Timer::sleep $SCHEDULE_INTERVAL; |
151 | } |
151 | } |
152 | }; |
152 | }; |
153 | |
153 | |
|
|
154 | sub find($) { |
|
|
155 | my ($tag) = @_; |
154 | |
156 | |
|
|
157 | utf8::encode (my $key = $tag); |
|
|
158 | BDB::db_get $db_target, undef, $key, my $data; |
|
|
159 | utf8::decode $data; |
|
|
160 | |
|
|
161 | map { $_->load; $_->find_tagged_objects ($tag) } |
|
|
162 | grep $_, |
|
|
163 | map { cf::map::find $_ } |
|
|
164 | grep s/^s//, |
|
|
165 | split /\x00/, $data |
|
|
166 | } |