The node_update_index() function seems to do a mini-version of node_view() without running the final result through theme_node(). However, node_view() invokes node_invoke_nodeapi($node, 'alter', $teaser, $page);
and node_update_index() does not. This means that modules that alter the display of a node body in all other cases (*cough* ConTemplate *cough*) will NOT alter the body during the indexing process. More simply, the search engine is not indexing what the user sees on the page.
This patch adds node_invoke_nodeapi($node, 'alter');
into node_update_index() in order to remedy this situation.
This is also a D5 bug and should be backported.
Comment | File | Size | Author |
---|---|---|---|
#1 | demo.module.txt | 214 bytes | greggles |
d6-node-alter-during-indexing.patch.txt | 719 bytes | jjeff |
Comments
Comment #1
gregglesI was able to repeat this bug and the patch solved the problem.
Steps for me to repeat:
1. create a demo module which alters the the content (see attached for trivial example)
2. Enable search and visit cron.php to index the site
3. search for content added by the alter (e.g. weasel)
Actual restuls: weasel is not found
To test the fix be sure to visit admin/settings/search and click re-index site and re-visit cron.php
The only question I *might* have is if this is a performance problem, but I don't think that's a real problem since search _is_ already doing a lot of work and is already scalable.
So, I'm marking as RTBC.
Comment #2
jjeff CreditAttribution: jjeff commentedThanks Greg! re: performance, there is certainly always potential for abuse but technically we've still got less overhead than node_view(). And there are still very few modules that implement 'alter'.
Comment #3
Gábor HojtsyLooks good, thanks! Committed.
Comment #4
jjeff CreditAttribution: jjeff commentedThis problem exists in D5 as well.
Haven't tested, but patch will most likely apply.
Comment #5
drummCommitted to 5.x.
IIRC, we added this in 5.x, so no need to 4.7.x.
Comment #6
(not verified) CreditAttribution: commented