Looking at the Solr logs, I noticed that the request URLs are being generated like this:

/select facet=true&fl=*,score&facet.mincount=1&facet.sort=true&start=10&q=TEST&facet.limit=-1&facet.field=tid&facet.field=tid&facet.field=type&facet.field=uid&wt=xml&rows=10&version=2.2

Notice the duplicated "facet.field=tid". It works BUT it's making the response twice as slow (in my tests) as the XML includes the term facet listing TWICE.

The culprit is Service.php, which can be fixed with this patch:

--- Service.php 2008-04-20 08:46:48.000000000 -0500
+++ Service.php_patched 2008-06-25 10:24:04.978665000 -0500
@@ -752,12 +752,9 @@
         {
           //parameter has multiple values that need passed
           //array_shift pops off the first value in the array and also removes it
-          $escapedParams[] = urlencode($key) . '=' . urlencode(array_shift($value));
-
-          if (empty($value))
-          {
-            unset($params[$key]);
-          }
+          foreach($value as $v) 
+            $escapedParams[] = urlencode($key) . '=' . urlencode($v);
+          unset($params[$key]);
         }
         else
         {
CommentFileSizeAuthor
Service.php_.patch_.txt658 bytesjanusman

Comments

robertdouglass’s picture

for Drupal code style this would be written:


          foreach ($value as $v) {
            $escapedParams[] = urlencode($key) . '=' . urlencode($v);
          }
          unset($params[$key]);
robertdouglass’s picture

Status: Needs review » Closed (won't fix)

I can't reproduce this of the 6.x branch. Furthermore, I'm going to update the SolrPhpClient with the updated version that uses JSON instead of XML, so I'm marking this won't fix and moving on to other issues.

janusman’s picture

This seems to be a problem with array_shift() in PHP; the expected behaviour is that array_shift() removes array values when called, however under certain versions of PHP this is broken.