Dancer-SearchApp

 view release on metacpan or  search on metacpan

bin/index-filesystem.pl  view on Meta::CPAN

                    return find_or_create_index($e, $index_name,$found_lang, 'file')
                })->then( sub {
                    my( $full_name ) = @_;
                    #warn $msg->{mime_type};
                    
                    # munge the title so we get magic completion for document titles:
                    # This should be mostly done in an Elasticsearch filter+analyzer combo
                    # Except for bands/song titles, which we want to manually munge
                    my @parts = map {lc $_}
                                ((split /\s+/, $msg->{title}),
                                (split m![\\/]!, $msg->{url}));
                    $msg->{title_suggest} = {
                        input => \@parts,
                        #output => $msg->{title},
                        
                        # Maybe some payload to directly link to the document. Later
                        #payload => {
                        #        url => $msg->{url}
                        #        # , $msg->{mime_type}
                        #    },
                    };

lib/Dancer/SearchApp/Defaults.pm  view on Meta::CPAN

        $options{ env } = \%ENV;
    };
    my $env = $options{ env };
    my $config = $options{ config };
    
    for my $entry (@{ $options{ names }}) {
        my ($result_name, $config_name, $env_name, $hard_default) = @$entry;
        
        if( defined $env_name and exists $env->{ $env_name } ) {
            #warn "Using $env_name from environment\n";
            my $result_loc = DiveRef($result, split m!/!, $result_name);
            $$result_loc //= $env->{ $env_name };
        };
        
        my $val = Dive( $config, split m!/!, $config_name );
        if( defined $config_name and defined( $val )) {
            #warn "Using $config_name from config ('$val')\n";
            my $result_loc = DiveRef($result, split m!/!, $result_name);
            $$result_loc //= $val;
        };
        
        if( ! defined Dive($result, split m!/!, $result_name) and defined $hard_default) {
            #warn "No $config_name from config, using hardcoded default\n";
            #print "Using $result_name from hard defaults ($hard_default)\n";
            my $result_loc = DiveRef($result, split m!/!, $result_name);
            $$result_loc = $hard_default;
        };
    };
    return $result;
};


1;



( run in 3.251 seconds using v1.01-cache-2.11-cpan-71847e10f99 )