I have restricted to the permissions for published content to not permit anonymous users to view this content. In other words, only authenticated users and site administrators can view published content. I have also created an Apache Solr view of a table containing these fields: label, a custom text field, a custom date field, and the path to the node. I'm also using a custom views template to generate the label as a link to the node, e.g., views-view-table-content_type-.tpl.php.

When an anonymous user goes to the views page, these notices and warnings are displayed, while the table is not displayed as expected.

Notice: Undefined property: stdClass::$name in apachesolr_access_apachesolr_query_alter() (line 101 of /home/drupal/public_html/sites/all/modules/apachesolr/apachesolr_access/apachesolr_access.module).
Notice: Trying to get property of non-object in apachesolr_views_query->execute() (line 159 of /home/drupal/public_html/sites/all/modules/apachesolr_views/apachesolr_views_query.inc).
Notice: Trying to get property of non-object in apachesolr_views_query->execute() (line 159 of /home/drupal/public_html/sites/all/modules/apachesolr_views/apachesolr_views_query.inc).
Notice: Trying to get property of non-object in apachesolr_views_query->execute() (line 165 of /home/drupal/public_html/sites/all/modules/apachesolr_views/apachesolr_views_query.inc).
Notice: Trying to get property of non-object in apachesolr_views_query->execute() (line 165 of /home/drupal/public_html/sites/all/modules/apachesolr_views/apachesolr_views_query.inc).
Warning: array_values() expects parameter 1 to be array, null given in view->execute() (line 1163 of /home/drupal/public_html/sites/all/modules/views/includes/view.inc).

The other non-views pages say "You are not authorized to access this page." Perhaps the Apache Solr views should do something similar.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

orange-wedge’s picture

Issue summary: View changes
MiroslavBanov’s picture

Version: 7.x-1.0-beta3 » 7.x-1.x-dev

I guess that apachesolr_views does not work well with apachesolr_access, and does not handle "abort_search" at all. As a workaround, you could try setting access to the view directly: "Access: Permission | View published content". I still think that we should try to handle $query->abort_search, even if this workaround helps in your situation.

MiroslavBanov’s picture

Status: Active » Needs review
FileSize
1.14 KB

Here is a patch to try to handle aborted apachesolr query.

MiroslavBanov’s picture

Status: Needs review » Closed (duplicate)