6 use Koha::SearchEngine;
11 my $se = Koha::SearchEngine->new;
12 is( $se->name, "Solr", "Test searchengine name eq Solr" );
14 my $config = $se->config;
15 $config->set_config_filename( "$FindBin::Bin/../indexes.yaml" );
16 my $ressource_types = $config->ressource_types;
17 is ( grep ( /^biblio$/, @$ressource_types ), 1, "Ressource type biblio must to be defined" );
18 is ( grep ( /^authority$/, @$ressource_types ), 1, "Ressource type authority must to be defined" );
20 my $indexes = $config->indexes;
21 is ( scalar(@$indexes), 3, "There are 3 indexes configured" );
23 my $index1 = @$indexes[0];
24 is ( $index1->{code}, 'title', "My index first have code=title");
25 is ( $index1->{label}, 'Title', "My index first have label=Title");
26 is ( $index1->{type}, 'ste', "My index first have type=ste");
27 is ( $index1->{ressource_type}, 'biblio', "My index first have ressource_type=biblio");
28 is ( $index1->{sortable}, '1', "My index first have sortable=1");
29 is ( $index1->{mandatory}, '1', "My index first have mandatory=1");
30 eq_array ( $index1->{mappings}, ["200\$a", "4..\$t"], "My first index have mappings=[200\$a,4..\$t]");
32 system( qq{/bin/cp $FindBin::Bin/../indexes.yaml /tmp/indexes.yaml} );
33 $config->set_config_filename( "/tmp/indexes.yaml" );
34 $indexes = $config->indexes;
39 ressource_type => 'biblio',
43 push @$indexes, $new_index;
44 $config->indexes( $indexes );
46 $indexes = $config->indexes;
48 my $isbn_index = $config->index( 'isbn' );
49 is( $isbn_index->{code}, 'isbn', 'Index isbn has been written' );
51 my $sortable_indexes = $config->sortable_indexes;
52 is ( @$sortable_indexes, 2, "There are 2 sortable indexes" );