Project:Similar entries
Version:master
Component:Code
Category:bug report
Priority:normal
Assigned:deekayen
Status:closed (fixed)

Issue Summary

it selects similar entries even they are in the submission queue...

Comments

#1

Try editing the SQL query at line 88 from the similar.module

And add: "AND n.status <> 0" to the Query.

It will look like this:

$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 AND n.status <> 0 ORDER BY score DESC', $text, $text, $similar_node_nid, 0, 5);

I think you can also use: "AND n.status = 1"

Regards

#2

I forgot to user the code mode:

Text to add to de query:
AND n.status <> 0

New query:

$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 AND n.status <> 0 ORDER BY score DESC', $text, $text, $similar_node_nid, 0, 5);

#3

Priority:normal» critical

Same problem here - hope it will be fixed soon.

#4

Status:active» needs review

Here is the patch that implements Povinho's solution. Please review so it can be committed ASAP.

AttachmentSize
similar.patch 817 bytes

#5

Status:needs review» reviewed & tested by the community

#6

Priority:critical» normal
Assigned to:Anonymous» deekayen

This affects http://drupal.org/node/41931 so I'll take it on.

#7

Version:4.6.x-1.x-dev» master
Status:reviewed & tested by the community» fixed

Added AND n.status <> 0 so the query only selects published nodes. Committed to CVS for DRUPAL-4-7.

#8

Status:fixed» closed (fixed)
nobody click here