From da4074de8135d671cfb742983ae492e9c83c238a Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 11 Jun 2013 16:44:35 -0400 Subject: [PATCH] Use the centralized initialization method for QP QueryParser maintains an effective singleton for internal configuration of the driver in order to avoid going to the database on every search request to gather configuration parameters. There is also a centralized sub that has the task of properly configuring said singleton. Previous to this commit we were not using that centralized initializer in one case, and that case happened to be the most important initialization of QP in all of Evergreen. The fallout from that was that some configuration was not being gathered and passed to QueryParser, resulting in incorrect search SQL being generated. This is rectified by using the centralized initializer everywhere that it is needed and can be used -- and particularly in the effected case. Signed-off-by: Mike Rylander Signed-off-by: Dan Scott --- .../Application/Storage/Publisher/metabib.pm | 41 +------------------ 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm index 9709fa8a8c..32d2cab4b0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm @@ -3202,46 +3202,7 @@ sub query_parser_fts_wrapper { my $parser = $OpenILS::Application::Storage::QParser; $parser->use; - if (!$parser->initialization_complete) { - my $cstore = OpenSRF::AppSession->create( 'open-ils.cstore' ); - $parser->initialize( - config_record_attr_index_norm_map => - $cstore->request( - 'open-ils.cstore.direct.config.record_attr_index_norm_map.search.atomic', - { id => { "!=" => undef } }, - { flesh => 1, flesh_fields => { crainm => [qw/norm/] }, order_by => [{ class => "crainm", field => "pos" }] } - )->gather(1), - search_relevance_adjustment => - $cstore->request( - 'open-ils.cstore.direct.search.relevance_adjustment.search.atomic', - { id => { "!=" => undef } } - )->gather(1), - config_metabib_field => - $cstore->request( - 'open-ils.cstore.direct.config.metabib_field.search.atomic', - { id => { "!=" => undef } } - )->gather(1), - config_metabib_search_alias => - $cstore->request( - 'open-ils.cstore.direct.config.metabib_search_alias.search.atomic', - { alias => { "!=" => undef } } - )->gather(1), - config_metabib_field_index_norm_map => - $cstore->request( - 'open-ils.cstore.direct.config.metabib_field_index_norm_map.search.atomic', - { id => { "!=" => undef } }, - { flesh => 1, flesh_fields => { cmfinm => [qw/norm/] }, order_by => [{ class => "cmfinm", field => "pos" }] } - )->gather(1), - config_record_attr_definition => - $cstore->request( - 'open-ils.cstore.direct.config.record_attr_definition.search.atomic', - { name => { "!=" => undef } } - )->gather(1), - ); - - $cstore->disconnect; - die("Cannot initialize $parser!") unless ($parser->initialization_complete); - } + _initialize_parser($parser) unless $parser->initialization_complete; if (! scalar( keys %{$args{searches}} )) { die "No search arguments were passed to ".$self->api_name; -- 2.43.2