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 399-401 INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' Link Here
399
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings', 'homebranch|holdingbranch', 'Choice');
399
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('SeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings', 'homebranch|holdingbranch', 'Choice');
400
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo');
400
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldings', '0', 'Separate current branch holdings from other holdings (OPAC)', NULL, 'YesNo');
401
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings (OPAC)', 'homebranch|holdingbranch', 'Choice');
401
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacSeparateHoldingsBranch', 'homebranch', 'Branch used to separate holdings (OPAC)', 'homebranch|holdingbranch', 'Choice');
402
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 6298-6303 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
6298
    SetVersion ($DBversion);
6298
    SetVersion ($DBversion);
6299
}
6299
}
6300
6300
6301
$DBversion = "3.11.00.XXX";
6302
if (CheckVersion($DBversion)) {
6303
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseQueryParser', '1', 'If enabled, try to use QueryParser for queries.', NULL, 'YesNo')");
6304
    print "Upgrade to $DBversion done (Bug 9239: Make it possible for Koha to use QueryParser)\n";
6305
    SetVersion ($DBversion);
6306
}
6307
    
6301
6308
6302
=head1 FUNCTIONS
6309
=head1 FUNCTIONS
6303
6310
(-)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