I get an error when searching attachments when I am not logged in as the Administrator. Works fine when logged in.

Error is:
user warning: Unknown column 'n.nid' in 'on clause' query: 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 INNER JOIN node_access na ON na.nid = n.nid WHERE f.status = 1 AND (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 1 AND na.realm = 'term_access'))) AND (i.word = 'parish') AND i.type = 'file' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1 ORDER BY score DESC LIMIT 0, 1 in /Library/WebServer/Documents/drupal/modules/search/search.module on line 945.

Comments

thl’s picture

Assigned: Unassigned » thl
Status: Active » Fixed

Please look at >= Beta3, the module has undergone major overhaul since your report.

Anonymous’s picture

Status: Fixed » Active

I'm sorry, but I still have the problem in version "6.x-2.0-beta3". I believe that the problem happen when the "Content Access" module (and some others access modules) is used.

thl’s picture

Status: Active » Postponed (maintainer needs more info)

I tried to reproduce the problem to no avail. A fresh and pretty much default installation of Drupal 6, enhanced with search_files works well with both search_files_attachments and search_files_directories no matter if logged in or not. Please try to figure out which core or 3rd party module exhibits the incompatibility. Also please try the four possible combinations of the search_files* modules to see which one(s) cause problems.

search_files+search_files_attachments+search_files_directories
search_files+search_files_attachments
search_files+search_files_directories
search_files

Thanks

Anonymous’s picture

Status: Postponed (maintainer needs more info) » Active

Here are the steps to reproduce the problem :

- Install Drupal 6.13 (very basic installation)
- Install and activate modules "search_file" and "search_attachments"
- Activate the core module "upload"
- Create a story with a PDF attached to test the search
- Config a PDF helper
- Run "cron.php"
- Give the permissions to authenticated and anonymous user to "search content", "view search_files results", "view uploaded files"
- Install and active module "content access" (last version, 1.2, http://drupal.org/project/content_access), with "content access permissions rebuild" (asked at the end of the activation)

Do an attachments search with admin account : no problem. Log out and do the attachments search again : the error appear.

Thanks!

thl’s picture

Priority: Critical » Normal
Status: Active » Needs review

dubej00, I tried to reproduce the problem with 6.x-2.x-beta4 to no avail. No issue with MySQL, neither with PostgreSQL. No problem searching anonymous. The error message looks somewhat related to #548156: Unknown column 'n.language' in 'where clause' query which has been fixed already. Maybe your issue is gone, too. Please retry.

Anonymous’s picture

Status: Needs review » Fixed

OK, the problem disappears with beta 4. But my next problem is describe in this issue : http://drupal.org/node/507298.

Thanks!

Status: Fixed » Closed (fixed)

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