From 664aa3a856dbfd22d032cb46933efc35c98a37d2 Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 4 Oct 2010 00:40:44 +0000 Subject: [PATCH] Allow caller to ignore selected facet classes; ignore identifier class by default git-svn-id: svn://svn.open-ils.org/ILS/trunk@18141 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Search/Biblio.pm | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index 7dad749036..96ca5d2f3e 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -1108,6 +1108,7 @@ sub staged_search { my $search_duration; my $user_offset = $search_hash->{offset} || 0; # user-specified offset my $user_limit = $search_hash->{limit} || 10; + my $ignore_facet_classes = $search_hash->{ignore_facet_classes}; $user_offset = ($user_offset >= 0) ? $user_offset : 0; $user_limit = ($user_limit >= 0) ? $user_limit : 10; @@ -1262,7 +1263,7 @@ sub staged_search { } ); - cache_facets($facet_key, $new_ids, $IAmMetabib) if $docache; + cache_facets($facet_key, $new_ids, $IAmMetabib, $ignore_facet_classes) if $docache; return undef; } @@ -1368,10 +1369,14 @@ __PACKAGE__->register_method( sub cache_facets { # add facets for this search to the facet cache - my($key, $results, $metabib) = @_; + my($key, $results, $metabib, $ignore) = @_; my $data = $cache->get_cache($key); $data ||= {}; + if (!ref($ignore)) { + $ignore = ['identifier']; # ignore the identifier class by default + } + return undef unless (@$results); # The query we're constructing @@ -1398,11 +1403,13 @@ sub cache_facets { }, from => { mfae => { - mmrsm => { field => 'source', fkey => 'source' } + mmrsm => { field => 'source', fkey => 'source' }, + cmf => { field => 'id', fkey => 'field' } } }, where => { - '+mmrsm' => { $count_field => $results } + '+mmrsm' => { $count_field => $results }, + '+cmf' => { field_class => { 'not in' => $ignore } } } } ); -- 2.11.0