Whenever any of my relevant content nodes have a revision, regardless of when the revision was made, these nodes go to the top of the related content list above other content that does not have a revision, but is in fact more recent. And it's not the revision date itself that's being used since nodes with an older revision date will appear above nodes with more recent created date. Even when I modify both the changed date in node table and revision date in node_revisions back to match the created date, the nodes still climb to the top of the list above more recent nodes. It is only when I entirely erase any earlier revisions that the node then appears in the right place in the list.

I've not scoured all the module code, but so far I found what appears to be the SQL that retreives the nodes in the relevant_content_get_nodes function in relevant_content.module, and it appears to call the created date and order by n.created DESC, so this should not be happening -- except that it is, so at some other point in the code, or during the merge of the $values array, the existence of revisions -- or of having some nodes with revisions and others with NO revisions -- is messing things up.

I've also not entirely analyzed that SQL statement, but it does not appear to explicitly select the most recent nodes or node revisions, but first selects ALL nodes and then orders and limits them. On a large site with many thousands of nodes, it seems that would

As a suggestion, adding ordering controls to the admin for this module would be helpful and may help solve whatever coding issue is at hand here by creating SQL that selects only what's required. People may actually want ot sort by most recent revision and not the created date, or ascending instead of descending, or sort by alphabetically by title, or group by term, etc..

Thanks for the greate module, though -- i have had no other major issues with it and it's an excellent addition to my sites!

Comments

nicholasthompson’s picture

Title: Ordering by revision and not created date. » Expose sort as a configuration option (created / updated)
Version: 6.x-1.5 » 7.x-1.x-dev
Assigned: Unassigned » nicholasthompson
Category: Bug report » Feature request
Status: Active » Needs work

Hi,

Thanks for taking the time to report this. D6 is no longer supported, so I wont be going back to fix that... And I have tried to replicate this on the D7 dev branch with no success.. so I dont think it's a bug anymore.

I made 3 nodes Alpha, Beta and Gamma, all with terms A and B set.. So all 3 were equally "related".
When viewing Gamma, it shows Beta then Alpha (as Alpha was oldest). I then went to Alpha and made a revision. After flushing caches, viewing Gamma showed nodes in the same order as before (ie Alpha as older). The revision did not affect the order.

However.. I do like your suggestion of exposing sorting options (created and updated, I guess? Not sure if revisions need to be involved? Although maybe sorting by published revision date could be an interesting edge-case...)

nicholasthompson’s picture

Version: 7.x-1.x-dev » 1.x-dev
Status: Needs work » Active

Feature request for the new D9 1.x version..