I'm receiving this error when performing a search.

When I disable the Search Rank plugin, the search feature works fine. I've uninstalled any module which might interfere, cleared caches, uninstalled and reinstalled the Search Rank module to no avail.

Any help or advice will be greatly appreciated.

user warning: Unknown column 'na.grant_view' in 'where clause' query: SELECT SUM(i.score * t.count) AS score FROM tu_search_index i INNER JOIN tu_search_total t ON i.word = t.word INNER JOIN tu_node n ON n.nid = i.sid INNER JOIN tu_users u ON n.uid = u.uid WHERE n.status = 1 AND (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all'))) AND (i.word = 'blah') AND i.type = 'node' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1 ORDER BY score DESC LIMIT 0, 1 in /modules/search/search.module on line 942.

Comments

tseven’s picture

The problem seems to stem from setting the search factor weight. Anything from the default 0 weight causes this error.

BlakeLucchesi’s picture

Thank you for posting this bug. It looks like there is an issue with node access grants. The node access table (aliased here as na) is not joined. Also, this looks like its coming from the default search.module not the search_ranking.module. Make sure you have both the search and search_ranking module installed.

Misange’s picture

Any correction ?
I have the same problem but surprisingly it only occurs with all users except the admin. When logged as the admin, it runs nicely. Any idea ?
Misange

whytewolf’s picture

I'm also having this issue. doing a little debugging of my own shows that the $join1 variable has the node_access information passed to it at the start, but it is stripped out before the do_search function is called.
at this line.
$join1= implode(' ', $rankings['join']);
however the corresponding where clause information is not stripped out.

changing line 184 from
$join1= implode(' ', $rankings['join']);
to
$join1= implode(' ', $rankings['join']) . ' ' . $join1;

fixed the error for me. however more testing would be needed

corydorning’s picture

this fixes the issue for me as well.

THANKS!

BlakeLucchesi’s picture

Status: Active » Closed (fixed)