From bdbec2aadf744331c25c27983402acbdfbe8396a Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Thu, 27 Sep 2012 16:48:03 -0400 Subject: [PATCH] QueryParser Driver: Add "lucky" modifier Forces to 1 result. Best used with redirect on single hit active. Because why not. Signed-off-by: Thomas Berezansky Signed-off-by: Lebbeous Fogle-Weekley --- .../perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm index 9fff3de9ee..16f4731b23 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm @@ -520,6 +520,7 @@ __PACKAGE__->add_search_filter( 'superpage_size' ); __PACKAGE__->add_search_filter( 'estimation_strategy' ); __PACKAGE__->add_search_modifier( 'available' ); __PACKAGE__->add_search_modifier( 'staff' ); +__PACKAGE__->add_search_modifier( 'lucky' ); # Start from container data (bre, acn, acp): container(bre,bookbag,123,deadb33fdeadb33fdeadb33fdeadb33f) __PACKAGE__->add_search_filter( 'container' ); @@ -626,6 +627,7 @@ sub toSQL { $key = 'm.metarecord' if (grep {$_->name eq 'metarecord' or $_->name eq 'metabib'} @{$self->modifiers}); my $core_limit = $self->QueryParser->core_limit || 25000; + $core_limit = 1 if($self->find_modifier('lucky')); my $flat_where = $$flat_plan{where}; if ($flat_where ne '') { -- 2.11.0