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 416-418 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
416
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo');
416
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo');
417
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UNIMARCField100Language', 'fre','UNIMARC field 100 default language',NULL,'short');
417
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UNIMARCField100Language', 'fre','UNIMARC field 100 default language',NULL,'short');
418
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo');
418
INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('Persona',0,'Use Mozilla Persona for login','','YesNo');
419
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 (+7 lines)
Lines 6444-6449 if ( CheckVersion($DBversion) ) { Link Here
6444
    SetVersion($DBversion);
6444
    SetVersion($DBversion);
6445
}
6445
}
6446
6446
6447
$DBversion = "3.11.00.XXX";
6448
if (CheckVersion($DBversion)) {
6449
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '1', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo')");
6450
    print "Upgrade to $DBversion done (Bug 9239: Make it possible for Koha to use QueryParser)\n";
6451
    SetVersion ($DBversion);
6452
}
6453
6447
6454
6448
=head1 FUNCTIONS
6455
=head1 FUNCTIONS
6449
6456
(-)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