We had an issue where certain node types wouldn't respect node access (with their related taxonomy) in groups on an OA site. In sphinxGetOrdinals(), Sphinx is queried for a set of nid's that are then used with Views to match up the Sphinx node type ID and Drupal node type machine name. The problem is that when cron runs as an anonymous user to index Searchlight, sometimes this cache has to be rebuilt and the anonymous user might not have access to the nodes that Sphinx returns (this is especially true if the first node of a new type is in a private test/dev group). From a code perspective, this is because $view->execute() calls db_rewrite_sql() and modifies the original query to join with the node_access table.

Attached is a hack to get this to work, by switching to UID 1 while running the views query. Probably this section of code should be reworked to query the database directly (instead of just using views), but I'm unsure what the implications might be since this is used to generate ordinals for users and comments as well. Any ideas?

CommentFileSizeAuthor
node_access_for_ordinals.patch983 bytestylor