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

(-)a/catalogue/search.pl (-1 / +2 lines)
Lines 427-432 my $count = C4::Context->preference('numSearchResults') || 20; Link Here
427
my $results_per_page = $params->{'count'} || $count;
427
my $results_per_page = $params->{'count'} || $count;
428
my $offset = $params->{'offset'} || 0;
428
my $offset = $params->{'offset'} || 0;
429
my $whole_record = $params->{'whole_record'} || 0;
429
my $whole_record = $params->{'whole_record'} || 0;
430
my $weight_search = $params->{'weight_search'} || 0;
430
$offset = 0 if $offset < 0;
431
$offset = 0 if $offset < 0;
431
my $page = $cgi->param('page') || 1;
432
my $page = $cgi->param('page') || 1;
432
#my $offset = ($page-1)*$results_per_page;
433
#my $offset = ($page-1)*$results_per_page;
Lines 446-452 my $searcher = Koha::SearchEngine::Search->new( Link Here
446
    $query_type
447
    $query_type
447
  )
448
  )
448
  = $builder->build_query_compat( \@operators, \@operands, \@indexes, \@limits,
449
  = $builder->build_query_compat( \@operators, \@operands, \@indexes, \@limits,
449
    \@sort_by, $scan, $lang, { weighted_fields => !$cgi->param('advsearch'), whole_record => $whole_record });
450
    \@sort_by, $scan, $lang, { weighted_fields => $weight_search, whole_record => $whole_record });
450
451
451
$template->param( search_query => $query ) if C4::Context->preference('DumpSearchQueryTemplate');
452
$template->param( search_query => $query ) if C4::Context->preference('DumpSearchQueryTemplate');
452
453
(-)a/cataloguing/addbooks.pl (-1 / +1 lines)
Lines 74-80 if ($query) { Link Here
74
    my $searcher = Koha::SearchEngine::Search->new(
74
    my $searcher = Koha::SearchEngine::Search->new(
75
        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
75
        { index => $Koha::SearchEngine::BIBLIOS_INDEX } );
76
    ( undef, $builtquery, undef, $query_cgi, undef, undef, undef, undef, undef, undef ) =
76
    ( undef, $builtquery, undef, $query_cgi, undef, undef, undef, undef, undef, undef ) =
77
      $builder->build_query_compat( undef, \@operands, undef, undef, undef, 0, $lang );
77
      $builder->build_query_compat( undef, \@operands, undef, undef, undef, 0, $lang, { weighted_fields => 1 });
78
78
79
    $template->param( search_query => $builtquery ) if C4::Context->preference('DumpSearchQueryTemplate');
79
    $template->param( search_query => $builtquery ) if C4::Context->preference('DumpSearchQueryTemplate');
80
80
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/advsearch.tt (-3 / +7 lines)
Lines 93-101 Link Here
93
<!-- BOOLEAN SEARCH OPTIONS -->
93
<!-- BOOLEAN SEARCH OPTIONS -->
94
    <fieldset id="searchterms">
94
    <fieldset id="searchterms">
95
    <legend>Search for </legend>
95
    <legend>Search for </legend>
96
    [% IF Koha.Preference('ElasticsearchMARCFormat') == 'ARRAY' %]
96
    [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]
97
        <input type="checkbox" name="whole_record">
97
        [% IF Koha.Preference('ElasticsearchMARCFormat') == 'ARRAY' %]
98
        <label for="whole_record">Search entire MARC record</label>
98
            <input type="checkbox" name="whole_record">
99
            <label for="whole_record">Search entire MARC record</label>
100
        [% END %]
101
        <input type="checkbox" name="weight_search" checked>
102
        <label for="weight_search">Apply field weightings to search</label>
99
    [% END %]
103
    [% END %]
100
    [% FOREACH search_box IN search_boxes_loop %]
104
    [% FOREACH search_box IN search_boxes_loop %]
101
        [% IF ( search_boxes_label ) %]<div style="text-indent: 4.5em;">[% ELSE %]<div>[% END %]
105
        [% IF ( search_boxes_label ) %]<div style="text-indent: 4.5em;">[% ELSE %]<div>[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc (+1 lines)
Lines 158-163 Link Here
158
                            <div id="opac-main-search">
158
                            <div id="opac-main-search">
159
                                [% IF Koha.Preference('OpacCustomSearch') == '' %]
159
                                [% IF Koha.Preference('OpacCustomSearch') == '' %]
160
                                    <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform">
160
                                    <form name="searchform" method="get" action="/cgi-bin/koha/opac-search.pl" id="searchform">
161
                                        <input type="hidden" name="weight_search" value="1">
161
                                        <div class="form-row align-items-center">
162
                                        <div class="form-row align-items-center">
162
                                            <div class="col-sm-auto order-1 order-sm-1">
163
                                            <div class="col-sm-auto order-1 order-sm-1">
163
                                                <label for="masthead_search"> Search
164
                                                <label for="masthead_search"> Search
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt (+4 lines)
Lines 30-35 Link Here
30
                    <div id="booleansearch" class="maincontent">
30
                    <div id="booleansearch" class="maincontent">
31
                        <fieldset>
31
                        <fieldset>
32
                            <legend>Search for:</legend>
32
                            <legend>Search for:</legend>
33
                            [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]
34
                                <input type="checkbox" name="weight_search" checked>
35
                                <label for="weighted_search">Apply field weightings to search</label>
36
                            [% END %]
33
                            [% IF ( expanded_options ) %]
37
                            [% IF ( expanded_options ) %]
34
                                <div class="advanced-search-terms extended">
38
                                <div class="advanced-search-terms extended">
35
                            [% ELSE %]
39
                            [% ELSE %]
(-)a/opac/opac-search.pl (-2 / +2 lines)
Lines 532-537 $offset = 0 if $offset < 0; Link Here
532
my $page = $cgi->param('page') || 1;
532
my $page = $cgi->param('page') || 1;
533
$offset = ($page-1)*$results_per_page if $page>1;
533
$offset = ($page-1)*$results_per_page if $page>1;
534
my $hits;
534
my $hits;
535
my $weight_search = $cgi->param('weight_search') || 0;
535
536
536
# Define some global variables
537
# Define some global variables
537
my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type);
538
my ($error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$query_type);
Lines 562-568 if (C4::Context->preference('OpacSuppression')) { Link Here
562
    {
563
    {
563
        suppress => $suppress,
564
        suppress => $suppress,
564
        is_opac => 1,
565
        is_opac => 1,
565
        weighted_fields => !$cgi->param('advsearch')
566
        weighted_fields => $weight_search
566
    }
567
    }
567
);
568
);
568
569
569
- 

Return to bug 24155