This patch adds to Doug Green's patch #145242 that adds support for a hook_ranking. It allows nodes that are linked to by other nodes to be scored higher than nodes without links to them. This requires a new table which keeps a count of all the links that a node has received that is updated on cron in the search_index function
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | search_link_ranking_2.patch | 4.55 KB | keith.smith |
| #1 | search_link_ranking.patch | 4.46 KB | BlakeLucchesi |
Comments
Comment #1
BlakeLucchesi commentedThis patch adds a ranking hook definition for the node module so that nodes with more inbound links can receive a higher relevancy factor.
Note: Because of the way the link finder works, you may need to run cron a couple of times to ensure that the links were counted. Links get inserted into the table: search_node_links first, and each node that was linked to is then tagged for re-indexing, during this second indexing we count the number of links and store them in table: search_node_links_total.
Comment #2
douggreen commentedI don't like that there are up to 3 extra queries on every node that gets indexed, especially if this ranking isn't used.
I'd have a look at putting something like this in search_update_totals:
The search_sid_dirty() function doesn't exist. I suspect that this will be useful so that the DELETE and INSERT only affect a dozen nodes instead of ALL of them.
Notice that I'm only doing the update if the node_rank_link is used. Because of this, you'll need to do two more queries when the node_rank_link gets set to something other than 0, maybe in a submit handler from a form_alter?
Comment #3
keith.smith commentedMinor, but at least one code comment does not end in a full stop (period).
Comment #4
keith.smith commentedI have no real comment on the patch regarding post #2, Doug is in a much better position to evaluate its merits.
However, the attached patch makes the following changes from the previous patch:
+ 'description' => t('The number of links that the searchable item has linking to it')
---
+ 'description' => t('The number of links that the searchable item has linking to it.')
+ 'description' => t('The number of links that the searchable item has linking to it')
---
+ 'description' => t('The number of links that the searchable item has linking to it.')
+ // Update node_links_totals count for this node
---
+ // Update node_links_totals count for this node.
Comment #5
cwgordon7 commentedThere is no attached patch in #4
Comment #6
keith.smith commentedHmmm. D.o eats another patch. It's on my office computer so I'll upload it tomorrow. Thanks for noticing!
Comment #7
keith.smith commentedI believe that I meant to upload this patch (or did, and it went somewhere mysterious).
Comment #8
Anonymous (not verified) commentedThe last submitted patch failed testing.
Comment #9
jhodgdonBumping to 8.x at this point.
Comment #10
jhodgdonDrupal 8 core search had a totally broken implemention of the node link checking stuff, and so when we converted search to a plugin system, we stopped supporting node link checking. This would need to be done in a contrib module now. Sorry...