The search files modules seems to have conflicts with node acces modules.
I have this error message :

user warning: Unknown column 'n.nid' in 'on clause' query: do_search /* Anonymous : do_search */ SELECT SUM(i.score * t.count) AS score FROM search_index i INNER JOIN search_total t ON i.word = t.word INNER JOIN files f ON f.fid = i.sid <b>INNER JOIN node_access na ON na.nid = n.nid</b> WHERE f.status = 1 AND (i.word = 'ministers') AND i.type = 'file' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1 ORDER BY score DESC LIMIT 0, 1 in /var/www/html/acquia-drupal-ecas-test/modules/search/search.module on line 946.
CommentFileSizeAuthor
#3 search_files-DRUPAL-6--2.db-rewrite-sql.patch733 bytessun

Comments

seancorrales’s picture

I've encountered the same error message. The issue appears to be with privileges. You can resolve this issue in a poor fashion by giving the "administer nodes" privilege to users who use the file search.

It doesn't do much for standard users, though. Giving out "administer nodes" isn't a good idea.

edward.peters’s picture

I am getting the same problem. There is no reference in the SQL to the node table (n). Anyone found a solution?

sun’s picture

Title: conflict with node access » Improper use of db_rewrite_sql()
Version: 6.x-2.0-beta1 » 6.x-2.0-beta3
Status: Active » Reviewed & tested by the community
StatusFileSize
new733 bytes

Better title.

Attached patch passed the proper arguments to _db_rewrite_sql(), which fixes this bug.

thl’s picture

Status: Reviewed & tested by the community » Fixed

Patch taken verbatim, see search_files_attachments.module revision 1.1.2.17.
Fixed. Thanks.

thl’s picture

Assigned: Unassigned » thl
Status: Fixed » Closed (fixed)