selects nodes from queue

baybara - September 8, 2005 - 07:24
Project:Similar Entries
Version:HEAD
Component:Code
Category:bug report
Priority:normal
Assigned:deekayen
Status:closed
Description

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

#1

povinho - October 12, 2005 - 23:48

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

povinho - October 12, 2005 - 23:52

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

naudefj - October 13, 2005 - 19:15
Priority:normal» critical

Same problem here - hope it will be fixed soon.

#4

naudefj - October 13, 2005 - 19:29
Status:active» patch (code needs review)

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

AttachmentSize
similar.patch817 bytes

#5

naudefj - December 22, 2005 - 20:29
Status:patch (code needs review)» patch (reviewed & tested by the community)

#6

deekayen - January 3, 2006 - 22:06
Priority:critical» normal
Assigned to:Anonymous» deekayen

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

#7

deekayen - January 4, 2006 - 02:09
Version:4.6.x-1.x-dev» HEAD
Status:patch (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

Anonymous - January 18, 2006 - 02:20
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.