};
}
+sub register_map {
+ my ($self, $conn, $auth, $hint, $map) = @_;
+
+ $key = 'flat_search_' . md5_hex(
+ $hint .
+ OpenSRF::Utils::JSON->perl2JSON( $map )
+ );
+
+ $cache->put_cache( $key => { hint => $hint, map => $map } => $cache_timeout );
+}
+
+__PACKAGE__->register_method(
+ method => 'register_map',
+ api_name => 'open-ils.fielder.flattened_search.prepare',
+ argc => 2,
+ signature => {
+ params => [
+ {name => "auth", type => "string", desc => "auth token"},
+ {name => "hint", type => "string",
+ desc => "fieldmapper class hint of core object"},
+ {name => "map", type => "object", desc => q{
+ path-field mapping structure. See documentation under
+ docs/TechRef/Flattener in the Evergreen source tree.} }
+ ],
+ return => {
+ desc => q{
+ A key used to reference a prepared flattened search on subsequent
+ calls to open-ils.fielder.flattened_search.execute},
+ type => "string"
+ }
+ }
+);
+
+sub execute_registered_flattened_search {
+ my $self = shift;
+ my $conn = shift;
+ my $auth = shift;
+ my $key = shift;
+
+ my $blob = $cache->get_cache( $key );
+
+ flattened_search( $self, $conn, $auth, $blob->{hint}, $blob->{map}, @_ )
+ if (ref($blob) and $blob->{hint} and $blob->{map});
+}
+
+__PACKAGE__->register_method(
+ method => 'execute_registered_flattened_search',
+ api_name => 'open-ils.fielder.flattened_search.execute',
+ stream => 1,
+ argc => 5,
+ signature => {
+ params => [
+ {name => "auth", type => "string", desc => "auth token"},
+ {name => "key", type => "string",
+ desc => "Key for a registered map provided by open-ils.fielder.flattened_search.prepare"},
+ {name => "where", type => "object", desc => q{
+ simplified query clause (like the 'where' clause of a
+ json_query, but different). See documentation under
+ docs/TechRef/Flattener in the Evergreen source tree.} },
+ {name => "slo", type => "object", desc => q{
+ simplified sort/limit/offset object. See documentation under
+ docs/TechRef/Flattener in the Evergreen source tree.} }
+ ],
+ return => {
+ desc => q{
+ A stream of objects flattened to your specifications. See
+ documentation under docs/TechRef/Flattener in the Evergreen
+ source tree.},
+ type => "object"
+ }
+ }
+);
+
sub flattened_search {
my ($self, $conn, $auth, $hint, $map, $where, $slo) = @_;
# Process the map to normalize it, and to get all our joins and fleshing
# structure into the jffolo.
- my ($map, $jffolo) =
+ my $jffolo;
+ ($map, $jffolo) =
OpenILS::Application::Flattener::process_map($hint, $map);
# Process the suppied where clause, using our map, to make the