Closed (works as designed)
Project:
Similar Entries
Version:
5.x-2.0
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
19 May 2008 at 12:27 UTC
Updated:
19 May 2008 at 20:09 UTC
there are several parameters applied to the queries in function theme_similar_content.
The last two of them seem to be unused / ignored .
Is the query incomplete?
db_query_range("SELECT r.nid, MATCH(r.body, r.title) AGAINST ('%s') AS score FROM {node_revisions} r INNER JOIN {node} n ON r.nid = n.nid AND r.vid = n.vid INNER JOIN {term_node} t ON n.nid = t.nid AND t.tid IN ($taxonomy_tids) WHERE MATCH(r.body, r.title) AGAINST ('%s') AND n.status <> 0 AND r.nid <> %d AND n.type IN ($types) GROUP BY n.nid ORDER BY score DESC, r.vid DESC", $text, $text, $node->nid, 0, variable_get('similar_num_display', 5));
Comments
Comment #1
deekayen commenteddb_query_range is a special wrapper to queries. The last two parameters are used to insert a LIMIT clause on the end of the statement. The theory is that it makes the query more compatible across DB types (MySQL vs PostgreSQL). In this case, 0 says to start from the top and similar_num_display is the setting defaulting to 5 to pull only five matches from the DB then stop searching.
Comment #2
schildi commentedyes, of course. I know the function of the LIMIT clause but didn't realize that the parameters were applied to the db_query_range.
Sorry for that!