From ca05e08477b36fbf15ba45ff188a850b08486890 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 16 Apr 2010 20:04:56 +0000 Subject: [PATCH] get MR facets when we are doing an MR search ... duh. also need to adjust how we count. later git-svn-id: svn://svn.open-ils.org/ILS/trunk@16259 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Search/Biblio.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index 3e9cc7c3c0..7f40d07e2b 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -1178,7 +1178,8 @@ sub staged_search { } ); - cache_facets($facet_key, $new_ids) if $docache; + cache_facets($facet_key, $new_ids, ($self->api_name =~ /metabib/) ? 1 : 0) if $docache; + return undef; } @@ -1215,7 +1216,7 @@ __PACKAGE__->register_method( sub cache_facets { # add facets for this search to the facet cache - my($key, $results) = @_; + my($key, $results, $metabib) = @_; my $data = $cache->get_cache($key); $data ||= {}; @@ -1232,6 +1233,14 @@ sub cache_facets { # and mfae.source in IDLIST # group by 1,2; + if ($metabib) { + $results = { + select => { mmrsm => [ 'source' ] }, + from => 'mmrsm', + where => { metarecord => $results } + }; + } + my $facets = $U->cstorereq( "open-ils.cstore.json_query.atomic", { select => { cmf => [ 'id' ], @@ -1247,7 +1256,7 @@ sub cache_facets { ] }, from => { mfae => 'cmf' }, - where => { '+cmf' => 'facet_field', '+mfae' => { source => $results } } + where => { '+cmf' => 'facet_field', '+mfae' => { source => { in => $results } } } } ); -- 2.11.0