Posted by ec on January 9, 2006 at 5:59pm
Jump to:
| Project: | Similar entries |
| Version: | 4.6.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (duplicate) |
Issue Summary
Hello,
Similar seems not to be working with node_acess API. In function _similar_content() I need to add db_rewrite_sql(). Just replace
$result = db_query_range('SELECT n.nid, n.title , match(n.body, n.title) AGAINST ("%s") AS score FROM {node} n WHERE MATCH(n.body, n.title) AGAINST ("%s") AND n.nid <> %d ORDER BY score DESC', $text, $text, $similar_node_nid, 0, 5);
with
$result = db_query_range(db_rewrite_sql('SELECT n.nid, n.title , match(n.body, n.title) AGAINST ("%s") AS score FROM {node} n WHERE MATCH(n.body, n.title) AGAINST ("%s") AND n.nid <> %d ORDER BY score DESC'), $text, $text, $similar_node_nid, 0, 5);.
Hope, this help.
eric
Comments
#1
sorry, set it to normal. and may be it could apply for 4.7 ?
#2
I don't understand what exactly db_rewrite_sql() would add in functionality. db_query_range() already does some rewriting. Do you mind elaborating on the need for this change?
#3
Hy, db_rewrite_sql() takes care of permissions and let you see only the pots you have the right to see. It's usefull for ewample if you use thinks like og or tac to keep some posts private. eric
#4
try to do the same thing for 4.7 but the query doesn't work anymore !! any idea ? regards, eric.
#5
I know this issue was first, but it's finally in the newer versions through #520960: Similar entries: patch to allow hook_rewrite_sql calls.