[mb-commits] r9718 - mb_server/trunk/cgi-bin

root at musicbrainz.org root at musicbrainz.org
Mon Mar 3 12:08:44 UTC 2008


Author: luks
Date: 2008-03-03 12:08:44 +0000 (Mon, 03 Mar 2008)
New Revision: 9718

Modified:
   mb_server/trunk/cgi-bin/SearchEngine.pm
Log:
Use all words to generate the search query, not just the first one

This seems to be an old array vs. reference bug. The queries with all words have higher startup cost, but the overal cost is usually 2-3 lower than for the single-word queries and also the Perl code now has to do much less filtering.


Modified: mb_server/trunk/cgi-bin/SearchEngine.pm
===================================================================
--- mb_server/trunk/cgi-bin/SearchEngine.pm	2008-03-02 11:54:18 UTC (rev 9717)
+++ mb_server/trunk/cgi-bin/SearchEngine.pm	2008-03-03 12:08:44 UTC (rev 9718)
@@ -446,8 +446,9 @@
 
     my $results = eval {
 	local $sql->{Quiet} = 1;
+	my @wordids = map { $_->[0] } @$counts;
 	$sql->SelectListOfHashes(
-	    $self->_GetQuery(map { $_->[0] } @$counts),
+	    $self->_GetQuery(\@wordids),
 	)
     };
 
@@ -624,7 +625,8 @@
 sub _GetQuery
 {
     my $self = shift;
-    my @words = shift;
+    my $wordsref = shift;
+    my @words = @$wordsref;
     my $table = $self->Table;
     my $wtable = $table . "words";
     my $idcol = $table . "id";




More information about the MusicBrainz-commits mailing list