Update similar.module to Drupal 4.7
naudefj - December 21, 2005 - 05:40
| Project: | Similar Entries |
| Version: | HEAD |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | deekayen |
| Status: | closed |
Description
Module raises the following error when used with Drupal 4.7:
"Unknown column 'n.body' in 'field list' query:
SELECT n.nid, n.title , match(n.body, n.title) AGAINST ("...") AS score FROM node n WHERE MATCH(n.body, n.title) AGAINST ("...") AND n.nid <> 389 AND n.status <> 0 ORDER BY score DESC LIMIT 0, 5
in .../drupal/includes/database.mysql.inc on line 108."

#1
Poposed solution:
Change last line of README.txt:
ALTER TABLE node_revisions ADD FULLTEXT(title, body);
Change query in similar.module:
$result = db_query_range('SELECT n.nid, n.title , match(r.body, r.title) AGAINST ("%s") AS score FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid WHERE MATCH(r.body, r.title) AGAINST ("%s") AND n.nid <> %d AND n.status <> 0 ORDER BY score DESC', $text, $text, $similar_node_nid, 0, 5);
#2
Here is the patch.
#3
#4
The patch query didn't work, but I modified it and committed to CVS for DRUPAL-4-7.