When using the latest apachesolr, views 2.5, and the latest apachesolr_views I had to fix three minor errors to get it working on my setup. I just started looking at the apachesolr internals, so these fixes might not be correct. If they look correct and you want them in individual patches, I can do that...but they are all 1 line changes.

warning: Missing argument 3 for apachesolr_og_apachesolr_modify_query(), called in /var/www/html/sites/all/modules/apachesolr_views/apachesolr_views_query.inc on line 220 and defined in /var/www/html/sites/all/modules/apachesolr/contrib/apachesolr_og/apachesolr_og.module on line 27.

Fix is to add the third parameter - module name (apachesolr_views).

PHP Fatal error:  Declaration of apachesolr_views_query::get_filters() must be compatible with that of Drupal_Solr_Query_Interface::get_filters() in /var/www/html/sites/all/modules/apachesolr_views/apachesolr_views_query.inc on line 11

Fix is to add $name = NULL to the function declaration.

PHP Fatal error:  Cannot access protected property Solr_Base_Query::$id in /var/www/html/sites/all/modules/apachesolr_views/apachesolr_views_query.inc on line 567

Fix is to change the offending variable from $query->id to just $id. This one I'm the least certain about being the correct solution.

Comments

Scott Reynolds’s picture

Status: Needs review » Needs work

so the last change doesn't work. This is actually because the $id field was just made protected in the last apachesolr project commit. Workin on a workaround here soon. Your fix 'works' because $id is always 0. So it really doesn't work...

The other two changes are correct though.

drewish’s picture

shouldn't apachesolr_views_query::get_filters() look more like:

  /**
   * return an array of filters
   *
   * Compabatiablity layer with Solr_Base_Query
   */
  function get_filters($name = NULL) {
    $filters = array();
    foreach ($this->_facets as $type => $fields) {
      foreach ($fields as $data) {
        $filters['#name'] = ($data['exclude']) ? "NOT $type" : $type;
        $filters['#value'] = $data['value'];
      }
    }

    if (empty($name)) {
      return $filters;
    }
    $matches = array();
    foreach ($filters as $filter) {
      if ($filter['#name'] == $name) {
        $matches[] = $filter;
      }
    }
    return $matches;
  }

seems silly to totally ignore $name param

drewish’s picture

also after applying this patch I'm getting a new error:
Fatal error: Call to undefined method apachesolr_views_query::get_available_sorts() in modules/apachesolr/apachesolr.module on line 463

It looks like the apachesolr_block() function calls $query->get_available_sorts() but the function isn't part of the Drupal_Solr_Query_Interface interface. I can't tell if we should just implement get_available_sorts() or kick it over to the apachesolr queue to have them straighten out their interface.

Scott Reynolds’s picture

Need the method added to the interface and this class.

Ignoring the name isn't the intention, just not ready to handle it yet :-D. apachesolr moving to fast :-D

Scott Reynolds’s picture

StatusFileSize
new3.71 KB

ok apply those two patches and do a new CVS checkout. Here is the patch that i just committed

Scott Reynolds’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

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