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

(-)a/C4/Context.pm (+43 lines)
Lines 105-110 use C4::Boolean; Link Here
105
use C4::Debug;
105
use C4::Debug;
106
use POSIX ();
106
use POSIX ();
107
use DateTime::TimeZone;
107
use DateTime::TimeZone;
108
use Module::Load::Conditional qw(can_load);
108
109
109
=head1 NAME
110
=head1 NAME
110
111
Lines 941-946 sub restore_dbh Link Here
941
    # return something, then this function should, too.
942
    # return something, then this function should, too.
942
}
943
}
943
944
945
=head2 queryparser
946
947
  $queryparser = C4::Context->queryparser
948
949
Returns a handle to an initialized Koha::QueryParser::Driver::PQF object.
950
951
=cut
952
953
sub queryparser {
954
    my $self = shift;
955
    unless (defined $context->{"queryparser"}) {
956
        $context->{"queryparser"} = &_new_queryparser();
957
    }
958
959
    return $context->{"queryparser"};
960
}
961
962
=head2 _new_queryparser
963
964
Internal helper function to create a new QueryParser object. QueryParser
965
is loaded dynamically so as to keep the lack of the QueryParser library from
966
getting in anyone's way.
967
968
=cut
969
970
sub _new_queryparser {
971
    my $qpmodules = {
972
        'OpenILS::QueryParser'           => undef,
973
        'Koha::QueryParser::Driver::PQF' => undef
974
    };
975
    if ( can_load( 'modules' => $qpmodules ) ) {
976
        my $QParser     = Koha::QueryParser::Driver::PQF->new();
977
        my $config_file = $context->config('queryparser_config');
978
        $config_file ||= '/etc/koha/searchengine/queryparser.yaml';
979
        if ( $QParser->load_config($config_file) ) {
980
            # TODO: allow indexes to be configured in the database
981
            return $QParser;
982
        }
983
    }
984
    return;
985
}
986
944
=head2 marcfromkohafield
987
=head2 marcfromkohafield
945
988
946
  $dbh = C4::Context->marcfromkohafield;
989
  $dbh = C4::Context->marcfromkohafield;
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 395-397 INSERT INTO systempreferences (`variable`, `value`, `options`, `explanation`, `t Link Here
395
('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'),
395
('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'),
396
('PatronSelfRegistrationBorrowerMandatoryField',  'surname|firstname', NULL ,  'Choose the mandatory fields for a patron''s account, when registering via the OPAC.',  'free'),
396
('PatronSelfRegistrationBorrowerMandatoryField',  'surname|firstname', NULL ,  'Choose the mandatory fields for a patron''s account, when registering via the OPAC.',  'free'),
397
('PatronSelfRegistrationBorrowerUnwantedField',  '', NULL ,  'Name the fields you don''t want to display when registering a new patron via the OPAC.',  'free');
397
('PatronSelfRegistrationBorrowerUnwantedField',  '', NULL ,  'Name the fields you don''t want to display when registering a new patron via the OPAC.',  'free');
398
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '1', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+8 lines)
Lines 6285-6290 if (CheckVersion($DBversion)) { Link Here
6285
    SetVersion ($DBversion);
6285
    SetVersion ($DBversion);
6286
}
6286
}
6287
6287
6288
$DBversion = "3.11.00.XXX";
6289
if (CheckVersion($DBversion)) {
6290
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '1', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo')");
6291
    print "Upgrade to $DBversion done (Bug 9239: Make it possible for Koha to use QueryParser)\n";
6292
    SetVersion ($DBversion);
6293
}
6294
    
6295
6288
=head1 FUNCTIONS
6296
=head1 FUNCTIONS
6289
6297
6290
=head2 TableExists($table)
6298
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref (-1 / +7 lines)
Lines 58-63 Searching: Link Here
58
                  no: "Not using"
58
                  no: "Not using"
59
            - 'ICU Zebra indexing. Please note: This setting will not affect Zebra indexing, it should only be used to tell Koha that you have activated ICU indexing if you have actually done so, since there is no way for Koha to figure this out on its own.'
59
            - 'ICU Zebra indexing. Please note: This setting will not affect Zebra indexing, it should only be used to tell Koha that you have activated ICU indexing if you have actually done so, since there is no way for Koha to figure this out on its own.'
60
        -
60
        -
61
            - pref: UseQueryParser
62
              default: 1
63
              choices:
64
                  yes: Try
65
                  no: "Do not try"
66
            - 'to use the QueryParser module for parsing queries. Please note: enabling this will have no impact if you do not have QueryParser installed, and everything will continue to work as usual.'
67
        -
61
            - pref: IncludeSeeFromInSearches
68
            - pref: IncludeSeeFromInSearches
62
              default: 0
69
              default: 0
63
              choices:
70
              choices:
64
- 

Return to bug 9239