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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-1 / +9 lines)
Lines 295-301 sub build_query_compat { Link Here
295
            ? $self->_build_field_match_boost_query( { operands => $operands, indexes => \@index_params } )
295
            ? $self->_build_field_match_boost_query( { operands => $operands, indexes => \@index_params } )
296
            : [];
296
            : [];
297
        $limits = $self->_fix_limit_special_cases($orig_limits);
297
        $limits = $self->_fix_limit_special_cases($orig_limits);
298
        if ( $params->{suppress} ) { push @$limits, "suppress:false"; }
298
        if ( $params->{suppress} ) {
299
            push @$limits, "suppress:false";
300
            if ( C4::Context->preference('OPACAlwaysSearchIndex') && C4::Context->preference('OPACAlwaysSearchValue') )
301
            {
302
                push @$limits,
303
                    C4::Context->preference('OPACAlwaysSearchIndex') . ":"
304
                    . C4::Context->preference('OPACAlwaysSearchValue');
305
            }
306
        }
299
307
300
        # Merge the indexes in with the search terms and the operands so that
308
        # Merge the indexes in with the search terms and the operands so that
301
        # each search thing is a handy unit.
309
        # each search thing is a handy unit.
(-)a/installer/data/mysql/atomicupdate/bug_36434_-_add_OPACAlwaysSearchKeyword_syspref.pl (+22 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number  => "36434",
5
    description =>
6
        "Specify an index/value that will be secretly included in all OPAC bibliographic and authority searches",
7
    up => sub {
8
        my ($args) = @_;
9
        my ( $dbh, $out ) = @$args{qw(dbh out)};
10
11
        $dbh->do(
12
            q{
13
                INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type)
14
                VALUES
15
                ('OPACAlwaysSearchIndex', '', NULL, 'Force OPAC bibliographic and authority searches to additionally search the provided index for the value from OPACAlwaysSearchValue', 'Free'),
16
                ('OPACAlwaysSearchValue', '', NULL, 'Force OPAC bibliographic and authority searches to additionally search the povided value in the index specified in OPACAlwaysSearchIndex', 'Free')
17
            }
18
        );
19
20
        say $out "Added system preferences 'OPACAlwaysSearchIndex' / 'OPACAlwaysSearchValue'";
21
    },
22
};
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (+6 lines)
Lines 131-136 Searching: Link Here
131
            - "<pre>ccode: [REF,ARC]</pre><br/>  - would mark all REF and ARC collections (Reference and Archives) items as unavailable in Z3950 results.<br/><br/>"
131
            - "<pre>ccode: [REF,ARC]</pre><br/>  - would mark all REF and ARC collections (Reference and Archives) items as unavailable in Z3950 results.<br/><br/>"
132
            - "You can define multiple keys and values, items meeting ANY of the criteria will be marked unavailable:<br/><br/>"
132
            - "You can define multiple keys and values, items meeting ANY of the criteria will be marked unavailable:<br/><br/>"
133
            - "<pre>itype: [REF]<br/>holdingbranch: [REPAIR]</pre><br/>  - would mark all reference items AND items at the REPAIR branch as unavailable."
133
            - "<pre>itype: [REF]<br/>holdingbranch: [REPAIR]</pre><br/>  - would mark all reference items AND items at the REPAIR branch as unavailable."
134
        -
135
            - Force OPAC bibliographic and authority searches to additionally search the index
136
            - pref: OPACAlwaysSearchIndex
137
            - "for the value"
138
            - pref: OPACAlwaysSearchValue
139
            - "to limit search results. Leave empty to disable this feature, both fields must be specified."
134
    Search form:
140
    Search form:
135
        -
141
        -
136
            - pref: LoadSearchHistoryToTheFirstLoggedUser
142
            - pref: LoadSearchHistoryToTheFirstLoggedUser
(-)a/opac/opac-authorities-home.pl (-4 / +4 lines)
Lines 56-61 if ( $op eq "do_search" ) { Link Here
56
    my $orderby        = $query->param('orderby');
56
    my $orderby        = $query->param('orderby');
57
    my @value          = $query->multi_param('value');
57
    my @value          = $query->multi_param('value');
58
    $value[0] ||= q||;
58
    $value[0] ||= q||;
59
    my $value_history = $value[0];
59
60
60
    # validation of "Where"
61
    # validation of "Where"
61
    my @valid_marc_list = qw( all match mainentry );
62
    my @valid_marc_list = qw( all match mainentry );
Lines 81-87 if ( $op eq "do_search" ) { Link Here
81
    $template->param( search_query => $search_query ) if C4::Context->preference('DumpSearchQueryTemplate');
82
    $template->param( search_query => $search_query ) if C4::Context->preference('DumpSearchQueryTemplate');
82
83
83
    # multi page display gestion
84
    # multi page display gestion
84
    my $value_url = uri_escape_utf8( $value[0] );
85
    my $value_url = uri_escape_utf8($value_history);
85
    my $base_url =
86
    my $base_url =
86
          "opac-authorities-home.pl?"
87
          "opac-authorities-home.pl?"
87
        . "marclist=$marclist[0]"
88
        . "marclist=$marclist[0]"
Lines 159-165 if ( $op eq "do_search" ) { Link Here
159
                my $new_search = C4::Search::History::add_to_session(
160
                my $new_search = C4::Search::History::add_to_session(
160
                    {
161
                    {
161
                        cgi        => $query,
162
                        cgi        => $query,
162
                        query_desc => $value[0],
163
                        query_desc => $value_history,
163
                        query_cgi  => $query_cgi_history,
164
                        query_cgi  => $query_cgi_history,
164
                        total      => $total,
165
                        total      => $total,
165
                        type       => "authority",
166
                        type       => "authority",
Lines 172-178 if ( $op eq "do_search" ) { Link Here
172
                    {
173
                    {
173
                        userid     => $loggedinuser,
174
                        userid     => $loggedinuser,
174
                        sessionid  => $query->cookie("CGISESSID"),
175
                        sessionid  => $query->cookie("CGISESSID"),
175
                        query_desc => $value[0],
176
                        query_desc => $value_history,
176
                        query_cgi  => $query_cgi_history,
177
                        query_cgi  => $query_cgi_history,
177
                        total      => $total,
178
                        total      => $total,
178
                        type       => "authority",
179
                        type       => "authority",
179
- 

Return to bug 36434