X-Git-Url: http://git.rot13.org/?p=MojoFacets.git;a=blobdiff_plain;f=lib%2FMojoFacets%2FData.pm;h=9f4d53ef7e8a6eac7d62a24738110f511e6dface;hp=83fce08a28c7e4b264595477171aa76f0e90c65b;hb=4fde37c9ffd336ea4155bb1398da758d15091eb8;hpb=c8c0b7b4427eddb17a6392328a989cb716927a56 diff --git a/lib/MojoFacets/Data.pm b/lib/MojoFacets/Data.pm index 83fce08..9f4d53e 100644 --- a/lib/MojoFacets/Data.pm +++ b/lib/MojoFacets/Data.pm @@ -651,6 +651,14 @@ sub lookup { warn "# lookup ",dump @_; my ( $vals, $on_path, $on_col, $code ) = @_; die "code is not sub{ ... } but ", dump $code unless ref $code eq 'CODE'; + + if ( ! exists $loaded->{$on_path} ) { + my @possible_paths = grep { /\Q$on_path\E/ } keys %$loaded; + die "more than one dataset available for '$on_path' ",dump @possible_paths if $#possible_paths > 0; + $on_path = shift @possible_paths; + warn "## fuzzy selected path $on_path"; + } + my $items = $loaded->{$on_path}->{data}->{items} || die "no items for $on_path"; if ( ! exists $lookup_path_col->{$on_path}->{$on_col} ) {