[open-ils-commits] r19572 - in trunk/Open-ILS/src/perlmods/lib/OpenILS: Application WWW (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Mar 3 15:47:28 EST 2011


Author: dbs
Date: 2011-03-03 15:47:23 -0500 (Thu, 03 Mar 2011)
New Revision: 19572

Modified:
   trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
   trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
Log:
Add complete set of Evergreen search aliases and attributes to SRU explain

Original "pull from database" code had limited the search aliases to those
that were qualified; now we pull all of them, and if they are not qualified,
we qualify them as "eg".

In addition, for some of the non-index attributes (sort, direction, site,
available), restore the descriptive title that was previously available.
Slightly longer term we will add a "description" column to
config.metabib_search_alias to store this information.

Also, we had always been using the global %qualifier_map in
return_sru_explain(), even though the intention was to enable the authority
explain index to pass in an overriding set of values. This commit breaks the
authority SRU explain, but as it had been incorrectly dumping the bib explain,
this brings us a step closer to proper explain support for authorities.


Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm	2011-03-03 16:04:38 UTC (rev 19571)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm	2011-03-03 20:47:23 UTC (rev 19572)
@@ -2848,12 +2848,17 @@
 
 	my $cmsa = $_storage->request(
 		'open-ils.cstore.direct.config.metabib_search_alias.search.atomic',
-		{ alias => { like => '%.%'} }
+		{ alias => { '!=' => undef } }
 	)->gather(1);
 
-    foreach my $alias (@$cmsa) {
-        my ($qualifier, $name) = $alias->alias =~ m/^(.+?)\.(.+)$/;
-        push(@{$aliases{$qualifier}}, $name);
+    foreach (@$cmsa) {
+        if ($_->alias =~ /\./) {
+            my ($qualifier, $name) = $_->alias =~ m/^(.+?)\.(.+)$/;
+            push(@{$aliases{$qualifier}}, $name);
+        } else {
+            # au/kw/se/su/ti go into the default 'eg' qualifier
+            push(@{$aliases{'eg'}}, $_->alias);
+        }
     }
 
     return \%aliases;

Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm	2011-03-03 16:04:38 UTC (rev 19571)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm	2011-03-03 20:47:23 UTC (rev 19572)
@@ -147,6 +147,27 @@
         ->request("open-ils.supercat.biblio.search_aliases")
         ->gather(1)};
 
+    # Append the non-search-alias attributes to the qualifier map
+    push(@{$qualifier_map{'eg'}}, qw/
+        available
+        ascending
+        descending
+        sort
+        format
+        before
+        after
+        statuses
+        locations
+        site
+        depth
+        lasso
+        offset
+        limit
+        preferred_language
+        preferred_language_weight
+        preferred_language_multiplier
+    /);
+
     my $list = $supercat
         ->request("open-ils.supercat.record.formats")
         ->gather(1);
@@ -1855,7 +1876,7 @@
 
     } elsif ( $resp->type eq 'explain' ) {
         return_sru_explain($cgi, $req, $resp, \$ex_doc,
-            \%OpenILS::WWW::SuperCat::nested_qualifier_map,
+            undef,
             \%OpenILS::WWW::SuperCat::qualifier_ids
         );
 
@@ -2004,11 +2025,12 @@
 }
 
 sub return_sru_explain {
-    my ($cgi, $req, $resp, $explain, $qualifier_map, $qualifier_ids) = @_;
+    my ($cgi, $req, $resp, $explain, $index_map, $qualifier_ids) = @_;
 
+    $index_map ||= \%qualifier_map;
     if (!$$explain) {
         my ($doc, $e) = explain_header($cgi);
-        for my $name ( keys %$qualifier_map ) {
+        for my $name ( keys %{$index_map} ) {
 
             my $identifier = $qualifier_ids->{ $name };
 
@@ -2019,8 +2041,18 @@
             $set_node->setAttribute( name => $name );
 
             $e->findnodes('/z:explain/z:indexInfo')->shift->appendChild( $set_node );
+            my %attribute_desc = (
+                site        => 'Evergreen Site Code (shortname)',
+                sort        => 'Sort on relevance, title, author, pubdate, create_date or edit_date',
+                dir         => 'Sort direction (asc|desc)',
+                available   => 'Filter to available (true|false)',
+            );
 
-            for my $index ( @{$qualifier_map{$name}} ) {
+            for my $index ( @{$index_map->{$name}} ) {
+                my $title = $index;
+                if (exists $attribute_desc{$title}) {
+                    $title = $attribute_desc{$title};
+                }
 
                 my $name_node = $doc->createElementNS( 'http://explain.z3950.org/dtd/2.0/', 'name' );
 
@@ -2034,7 +2066,7 @@
                 $index_node->appendChild( $map_node );
 
                 $index_node->setAttribute( id => "$name.$index" );
-                $title_node->appendText( $index);
+                $title_node->appendText($title);
                 $name_node->setAttribute( set => $name );
                 $name_node->appendText($index);
 



More information about the open-ils-commits mailing list