I'm using the dev version and always get this error message on any search:

warning: Invalid argument supplied for foreach() in /my/directory/structure/httpdocs/sites/all/modules/apachesolr/apachesolr.module on line 1190.

It's fine on the rc1 version but loving the CCK fields being indexed hence using dev

Comments

jtsnow’s picture

StatusFileSize
new901 bytes

CCK fields can be indexed using the 6.x-1.0 branch. Anyway, here is a quick band-aid fix for the problem.

Scott Reynolds’s picture

Status: Active » Needs work

best to follow coding standards and indent.

robertdouglass’s picture

Status: Needs work » Fixed
StatusFileSize
new1.04 KB

Looks ok for 6.2.

robertdouglass’s picture

Version: 6.x-2.x-dev » 6.x-1.x-dev
Status: Fixed » Patch (to be ported)

Let's confirm it's not an issue in the other branches.

claudiu.cristea’s picture

I'm a little bit confused. 6.x-2.x shows that $params['fq'] is a 2 level nested array.

$params['fq'][$delta][] = $value;

But in 5.x-2.x (6.x-1.x) seems to be only a 1 level deep. In apachesolr_search.module is handled:

  if (('' == $keys) && isset($params['fq'])) {
    // Move the fq params to the q.alt for better performance.
    $params['q.alt'] = implode(' ', $params['fq']);
    unset($params['fq']);
  }

Digging a little bit in 6.x-2.x-dev I found that next part is missed in apachesolr_modify_query() from 6.x-1.x and 5.x-2.x which seems to be critical on subqueries....

  if ($filter_queries = $params['fq']) {
    foreach ($filter_queries as $delta => $value) {
      $fq = $tag = '';
      $op = 'AND';
      // CCK facet field block deltas are not the same as their Solr index field names.
      $cck_delta = '';
      if (strpos($delta, '_cck_')) {
        $cck_delta = trim(drupal_substr($delta, 7, drupal_strlen($delta)));
      }
      if (in_array($delta, $ors) || in_array($cck_delta, $ors)) {
        $tag = "{!tag=$delta}";
        $op = 'OR';
      }
      $fq = implode(" $op ", $params['fq'][$delta]);
      $params['fq'][] = $tag . $fq;
      unset($params['fq'][$delta]);
    }
  }

This part transform $param['fq'] from a 2 level to an one level array.

Discussion needed...

robertdouglass’s picture

Status: Patch (to be ported) » Fixed

Ok - that's all related to OR facets. So let's not backport this as it's pretty complicated and disruptive.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.