fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-02-04 04:38 am

[dw-free] similar interest search doesn't support communities

[commit: http://hg.dwscoalition.org/dw-free/rev/f8088d524458]

http://bugs.dwscoalition.org/show_bug.cgi?id=3436

Also return communities when you search for users with similar interests as
$username.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/Controller/Search/Interests.pm
--------------------------------------------------------------------------------
diff -r 2ee7fedfe5d6 -r f8088d524458 cgi-bin/DW/Controller/Search/Interests.pm
--- a/cgi-bin/DW/Controller/Search/Interests.pm	Fri Feb 04 12:28:21 2011 +0800
+++ b/cgi-bin/DW/Controller/Search/Interests.pm	Fri Feb 04 12:36:34 2011 +0800
@@ -143,13 +143,16 @@ sub interest_handler {
         # perfect results?  no.  but who cares if somebody that lists "music"
         # or "reading" doesn't get an extra point towards matching you.
         # we care about more unique interests.
-        $sth = $dbr->prepare( "SELECT userid FROM userinterests WHERE intid=? LIMIT 500" );
-        foreach my $int ( @ints ) {
-            $sth->execute( $int );
-            while ( my $uid = $sth->fetchrow_array ) {
-                next if $uid == $u->userid;
-                $pt_weight{$uid} += ( 1 / log( $intcount{$int} + 1 ) );
-                $pt_count{$uid}++;
+
+        foreach ( qw( userinterests comminterests ) ) {
+            $sth = $dbr->prepare( "SELECT userid FROM $_ WHERE intid=? LIMIT 300" );
+            foreach my $int ( @ints ) {
+                $sth->execute( $int );
+                while ( my $uid = $sth->fetchrow_array ) {
+                    next if $uid == $u->userid;
+                    $pt_weight{$uid} += ( 1 / log( $intcount{$int} + 1 ) );
+                    $pt_count{$uid}++;
+                }
             }
         }
 
--------------------------------------------------------------------------------