From: Bill Erickson Date: Thu, 5 Jan 2012 18:18:29 +0000 (-0500) Subject: Do not exclude "identifier" facets by default X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7d66c78634d3b4bff7b34fcbb06031254729043c;p=evergreen%2Fjoelewis.git Do not exclude "identifier" facets by default No longer ignore "identifier" fields when collecting and caching facet data. This change causes all config.metabib_field's that are marked as facet_fields to be taken into consideration. Apart from marking a field as facet_field=false, it's also possible to control which fields are visible within the jspac and tpac (pending LP 911908) Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index 63687878bc..189ec6c377 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -1477,10 +1477,6 @@ sub cache_facets { 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 @@ -1494,29 +1490,33 @@ sub cache_facets { # group by 1,2; my $count_field = $metabib ? 'metarecord' : 'source'; - my $facets = $U->cstorereq( "open-ils.cstore.json_query.atomic", - { select => { - mfae => [ { column => 'field', alias => 'id'}, 'value' ], - mmrsm => [{ - transform => 'count', - distinct => 1, - column => $count_field, - alias => 'count', - aggregate => 1 - }] - }, - from => { - mfae => { - mmrsm => { field => 'source', fkey => 'source' }, - cmf => { field => 'id', fkey => 'field' } - } - }, - where => { - '+mmrsm' => { $count_field => $results }, - '+cmf' => { field_class => { 'not in' => $ignore }, facet_field => 't' } + my $query = { + select => { + mfae => [ { column => 'field', alias => 'id'}, 'value' ], + mmrsm => [{ + transform => 'count', + distinct => 1, + column => $count_field, + alias => 'count', + aggregate => 1 + }] + }, + from => { + mfae => { + mmrsm => { field => 'source', fkey => 'source' }, + cmf => { field => 'id', fkey => 'field' } } + }, + where => { + '+mmrsm' => { $count_field => $results }, + '+cmf' => { facet_field => 't' } } - ); + }; + + $query->{where}->{'+cmf'}->{field_class} = {'not in' => $ignore} + if ref($ignore) and @$ignore > 0; + + my $facets = $U->cstorereq("open-ils.cstore.json_query.atomic", $query); for my $facet (@$facets) { next unless ($facet->{value});