Hello,
I'm using fivestar and search modules. After node indexation the words SELECT, RATING, POOR, OKAY, GOOD, GREAT, AWESOME appears into search_index table. It's because fivestar module outputs it's code during execution _node_index_node. Is it possible to prevent this behavior?
Investigating this issue i found that following code change prevent this:
in fivestar.module in fivestar_nodeapi function (line 860 in 6.x-1.13) from
if ($node->build_mode != NODE_BUILD_PREVIEW && !isset($node->modr8_form_teaser) && variable_get('fivestar_'. $node->type, 0)) {
change to
if ($node->build_mode != NODE_BUILD_SEARCH_INDEX && $node->build_mode != NODE_BUILD_PREVIEW && !isset($node->modr8_form_teaser) && variable_get('fivestar_'. $node->type, 0)) {
Is this way correct?
Thank you.
Comment | File | Size | Author |
---|---|---|---|
#7 | fivestar_search_result_omit.patch | 955 bytes | quicksketch |
#6 | fivestar-322087_2.patch | 1.22 KB | Büke Beyond |
#4 | fivestar-322087.patch | 1.12 KB | Büke Beyond |
#1 | fivestar_prevent_search_6.x-1.13.patch | 888 bytes | chawl |
Comments
Comment #1
chawl CreditAttribution: chawl commentedThank you grafsl, I confirm this is working and also turned this into a patch for 6.x-1.13.
Please someone commit this change on the next release, as this "appearing in searches" problem is really annoying.
Tx in advance.
Comment #2
chawl CreditAttribution: chawl commentedOops.
Comment #3
quicksketchThanks chawl, committed.
Comment #4
Büke Beyond CreditAttribution: Büke Beyond commentedThis problem is not completely fixed. The above changes keeps the search index clean of the widget, fixing false search hits on words like "awesome".
However, the themed search module results still inject the widget and show words like "awesome" around any found content text. This is especially apparent with small node bodies.
There is actually a simple solution that I have tested for a couple of months:
Comment #5
quicksketchThis conditional isn't quite clear to me. You're also preventing Fivestar from showing up in places where you would want it, say in a listing a Full nodes provided by Views. I think if you don't want the Fivestar widget in the full node view, you could simply disable it from the full view.
Comment #6
Büke Beyond CreditAttribution: Büke Beyond commentedI have been testing Views listings with node Teaser displays, it has been rendering the widget correctly.
However, Full-page node listings in Views do suppress the widget as you describe, so here is a fix for that.
I have been monitoring the value of $teaser, $page and $node->build_mode, during various events, node load, view, alter, preview, search results, views, cron search indexing time...
Whenever both $teaser and $page lack the value true (they sometimes have null, sometimes 0), either the $node->build_mode == NODE_BUILD_SEARCH_INDEX, NODE_BUILD_PREVIEW, the search results are being output, or Views is listing Full-page nodes..
You see, the widget needs to be suppressed in core Search module results, this is the main point of this patch.
Comment #7
quicksketchAfter doing a little research, it turns out there's a build mode for "NODE_BUILD_SEARCH_RESULT". Adding this to list of build modes is an easy fix and much more clear about when the Fivestar widget is being omitted.
Comment #8
davegan CreditAttribution: davegan commentedHas this also been fixed in the Drupal 5 version?
Comment #9
quicksketchNo, the Drupal 5 version is no longer being developed (patches still accepted though). This solution is not applicable to the Drupal 5 version because it did not have the $node->build_mode property.