View | Details | Raw Unified | Return to bug 18316
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_18316_add-weight-column.perl (-1 / +1 lines)
Lines 1-7 Link Here
1
$DBversion = 'XXX';
1
$DBversion = 'XXX';
2
if( CheckVersion( $DBversion ) ) {
2
if( CheckVersion( $DBversion ) ) {
3
    if( !column_exists( 'search_field', 'weight' ) ) {
3
    if( !column_exists( 'search_field', 'weight' ) ) {
4
        $dbh->do( "ALTER TABLE `search_field` ADD COLUMN `weight` decimal(5,2) DEFAULT NULL" );
4
        $dbh->do( "ALTER TABLE `search_field` ADD COLUMN `weight` decimal(5,2) DEFAULT NULL AFTER `type`" );
5
    }
5
    }
6
6
7
    SetVersion( $DBversion );
7
    SetVersion( $DBversion );
(-)a/t/db_dependent/Koha/SearchEngine/Elasticsearch/QueryBuilder.t (-4 / +3 lines)
Lines 17-25 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 2;
21
use C4::Context;
20
use C4::Context;
22
use Test::Exception;
21
use Test::Exception;
22
use t::lib::TestBuilder;
23
use Test::More tests => 3;
23
use Test::More tests => 3;
24
24
25
use Koha::Database;
25
use Koha::Database;
Lines 160-170 subtest 'build_query with weighted fields tests' => sub { Link Here
160
    undef, undef, undef, { weighted_fields => 1 });
160
    undef, undef, undef, { weighted_fields => 1 });
161
161
162
    my $fields = $query->{query}{query_string}{fields};
162
    my $fields = $query->{query}{query_string}{fields};
163
164
    is(scalar(@$fields), 3, 'Search is done on 3 fields');
163
    is(scalar(@$fields), 3, 'Search is done on 3 fields');
165
    is($fields->[0], '_all', 'First search field is _all');
164
    is($fields->[0], '_all', 'First search field is _all');
166
    is($fields->[1], 'title^25', 'Second search field is title');
165
    is($fields->[1], 'title^25.00', 'Second search field is title');
167
    is($fields->[2], 'subject^15', 'Third search field is subject');
166
    is($fields->[2], 'subject^15.00', 'Third search field is subject');
168
};
167
};
169
168
170
$schema->storage->txn_rollback;
169
$schema->storage->txn_rollback;
(-)a/t/db_dependent/Koha/SearchField.t (-5 / +4 lines)
Lines 193-202 my @w_fields = Koha::SearchFields->weighted_fields(); Link Here
193
is(scalar(@w_fields), 3, 'weighted_fields should return 3 weighted fields.');
193
is(scalar(@w_fields), 3, 'weighted_fields should return 3 weighted fields.');
194
194
195
is($w_fields[0]->name, 'title', 'First field is title.');
195
is($w_fields[0]->name, 'title', 'First field is title.');
196
is($w_fields[0]->weight, 25, 'Title weight is 25.');
196
is($w_fields[0]->weight+0, 25, 'Title weight is 25.');
197
is($w_fields[1]->name, 'subject', 'Second field is subject.');
197
is($w_fields[1]->name, 'subject', 'Second field is subject.');
198
is($w_fields[1]->weight, 15, 'Subject weight is 15.');
198
is($w_fields[1]->weight+0, 15, 'Subject weight is 15.');
199
is($w_fields[2]->name, 'author', 'Third field is author.');
199
is($w_fields[2]->name, 'author', 'Third field is author.');
200
is($w_fields[2]->weight, 5, 'Author weight is 5.');
200
is($w_fields[2]->weight+0, 5, 'Author weight is 5.');
201
201
202
$schema->storage->txn_rollback;
202
$schema->storage->txn_rollback;
203
- 

Return to bug 18316