source: trunk/t/37_supersearch_summaries.t @ 543

Last change on this file since 543 was 543, checked in by kake, 17 years ago

Search efficiency fixes.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1use strict;
2use CGI::Wiki::Setup::SQLite;
3use Config::Tiny;
4use OpenGuides::SuperSearch;
5use Test::More;
6
7eval { require DBD::SQLite; };
8if ( $@ ) {
9    plan skip_all => "DBD::SQLite not installed";
10} else {
11    plan tests => 2;
12
13    # Clear out the database from any previous runs.
14    unlink "t/node.db";
15    unlink <t/indexes/*>;
16
17    CGI::Wiki::Setup::SQLite::setup( { dbname => "t/node.db" } );
18    my $config = Config::Tiny->new;
19    $config->{_} = {
20                     dbtype             => "sqlite",
21                     dbname             => "t/node.db",
22                     indexing_directory => "t/indexes",
23                     script_name        => "wiki.cgi",
24                     script_url         => "http://example.com/",
25                     site_name          => "Test Site",
26                     template_path      => "./templates",
27                   };
28
29    # Plucene is the recommended searcher now.
30    eval { require CGI::Wiki::Search::Plucene; };
31    unless ( $@ ) {
32        $config->{_}{use_plucene} = 1;
33    }
34
35    my $search = OpenGuides::SuperSearch->new( config => $config );
36    isa_ok( $search, "OpenGuides::SuperSearch" );
37    my $wiki = $search->wiki;
38    $wiki->write_node( "Pub Crawls", "The basic premise of the pub crawl is to visit a succession of pubs, rather than spending the entire evening or day in a single establishment. London offers an excellent choice of themes for your pub crawl.", undef, { category => "Pubs" } ) or die "Can't write node";
39
40    my $output = $search->run(
41                               return_output => 1,
42                               vars          => { search => "pub" }
43                             );
44    SKIP: {
45        skip "TODO: summaries", 1;
46        like( $output, qr|<b>pub</b>|i,
47              "outputs at least one bolded occurence of 'pub'" );
48    } # end of SKIP
49}
Note: See TracBrowser for help on using the repository browser.