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 408-410 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
408
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free');
408
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free');
409
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free');
409
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserCSS', '', NULL, 'Add CSS to be included in the SCO module in an embedded <style> tag.', 'free');
410
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
410
INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('SCOUserJS', '', NULL, 'Define custom javascript for inclusion in the SCO module', 'free');
411
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 6347-6352 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6347
    SetVersion($DBversion);
6347
    SetVersion($DBversion);
6348
}
6348
}
6349
6349
6350
$DBversion = "3.11.00.XXX";
6351
if (CheckVersion($DBversion)) {
6352
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '1', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo')");
6353
    print "Upgrade to $DBversion done (Bug 9239: Make it possible for Koha to use QueryParser)\n";
6354
    SetVersion ($DBversion);
6355
}
6356
6357
6350
=head1 FUNCTIONS
6358
=head1 FUNCTIONS
6351
6359
6352
=head2 TableExists($table)
6360
=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