Changeset 1183

Show
Ignore:
Timestamp:
07/29/06 19:51:38
Author:
miyagawa
Message:

Don't clobber if invindex is already there. Thanks to Marvin Humphrey

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Search/KinoSearch.pm

    r1177 r1183  
    2626    $self->{indexer} = KinoSearch::InvIndexer->new( 
    2727        invindex => $self->conf->{invindex}, 
    28         create   => 1
     28        create   => !-e $self->conf->{invindex}
    2929        analyzer => $self->{analyzer}, 
    3030    ); 
  • trunk/plagger/t/plugins/Search-KinoSearch/search.t

    r1177 r1183  
    99our $dir = File::Spec->catfile($FindBin::Bin, 'invindex'); 
    1010 
    11 plan tests => 5
     11plan tests => 8
    1212run_eval_expected; 
    1313 
     
    4747is $feed->count, 0, 'No match'; 
    4848 
     49=== Second run ... make sure it's not clobbered 
     50--- input config 
     51global: 
     52  log: 
     53    level: error 
     54plugins: 
     55  - module: Subscription::Config 
     56    config: 
     57      feed: 
     58        - file:///$FindBin::Bin/../../samples/rss-full.xml 
     59  - module: Search::KinoSearch 
     60    config: 
     61      invindex: $main::dir 
     62--- expected 
     63ok -e $main::dir, 'invindex exists'; 
     64 
     65# xxx this is clumsy 
     66no warnings 'redefine'; 
     67*Plagger::context = sub { $context }; 
     68 
     69my $feed; 
     70$context->run_hook('searcher.search', { query => "murakami" }, 0, sub { $feed = $_[0] }); 
     71ok $feed, 'I still got feed'; 
     72is $feed->count, 1, 'murakami matches 1'; 
     73