[LON-CAPA-cvs] cvs: loncom /interface lonsearchcat.pm /lonnet/perl lonnet.pm

droeschl droeschl@source.lon-capa.org
Tue, 04 May 2010 15:21:29 -0000


droeschl		Tue May  4 15:21:29 2010 EDT

  Modified files:              
    /loncom/interface	lonsearchcat.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Multidomain library servers will only queried once during searches instead of
  once for each domain. 
  
  
Index: loncom/interface/lonsearchcat.pm
diff -u loncom/interface/lonsearchcat.pm:1.321 loncom/interface/lonsearchcat.pm:1.322
--- loncom/interface/lonsearchcat.pm:1.321	Mon May  3 16:41:51 2010
+++ loncom/interface/lonsearchcat.pm	Tue May  4 15:21:26 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Search Catalog
 #
-# $Id: lonsearchcat.pm,v 1.321 2010/05/03 16:41:51 www Exp $
+# $Id: lonsearchcat.pm,v 1.322 2010/05/04 15:21:26 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1733,7 +1733,7 @@
         foreach (sort @allowed_domains) {
             $pretty_domains_string .= "<b>".$_."</b> ";
         }
-	my %servers = &Apache::lonnet::get_servers(\@allowed_domains,
+	my %servers = &Apache::lonnet::get_unique_servers(\@allowed_domains,
 						   'library');
 	$libraries_to_query = [keys(%servers)];
     }
@@ -2591,7 +2591,7 @@
             @Servers_to_contact = ($serverlist);
         }
     } else {
-	my %all_library_servers = &Apache::lonnet::all_library();
+	my %all_library_servers = &Apache::lonnet::unique_library();
         @Servers_to_contact = sort(keys(%all_library_servers));
     }
     my %Server_status;
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1061 loncom/lonnet/perl/lonnet.pm:1.1062
--- loncom/lonnet/perl/lonnet.pm:1.1061	Mon May  3 16:41:57 2010
+++ loncom/lonnet/perl/lonnet.pm	Tue May  4 15:21:29 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.1061 2010/05/03 16:41:57 www Exp $
+# $Id: lonnet.pm,v 1.1062 2010/05/04 15:21:29 droeschl Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -5452,6 +5452,8 @@
     my @server_list = (defined($server_array) ? @$server_array
                                               : keys(%libserv) );
     for my $server (@server_list) {
+#SD remove this
+&logthis("Querying server:$server");
 	unless ($custom or $customshow) {
 	    my $reply=&reply("querysend:".&escape($query),$server);
 	    $rhash{$server}=$reply;
@@ -9659,6 +9661,12 @@
 	return %libserv;
     }
 
+    sub unique_library {
+	#2x reverse removes all hostnames that appear more than once
+        my %unique = reverse &all_library();
+        return reverse %unique;
+    }
+
     sub get_servers {
 	&load_hosts_tab() if (!$loaded);
 
@@ -9682,6 +9690,11 @@
 	return %result;
     }
 
+    sub get_unique_servers {
+        my %unique = reverse &get_servers(@_);
+	return reverse %unique;
+    }
+
     sub host_domain {
 	&load_hosts_tab() if (!$loaded);