[open-ils-commits] r18141 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Search (miker)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Oct 3 20:40:45 EDT 2010


Author: miker
Date: 2010-10-03 20:40:44 -0400 (Sun, 03 Oct 2010)
New Revision: 18141

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Log:
Allow caller to ignore selected facet classes; ignore identifier class by default

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm	2010-10-03 15:06:45 UTC (rev 18140)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm	2010-10-04 00:40:44 UTC (rev 18141)
@@ -1108,6 +1108,7 @@
     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 @@
         }
     );
 
-    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 @@
 
 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 @@
             },
             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 } }
             }
         }
     );



More information about the open-ils-commits mailing list