IMO the sticky flag should override other measures of relevance. I think this patch does the trick:

624d623
<     $ranking[] = 'n.sticky * 100';
652c651
<     } 
---
>     }

Comments

David Lesieur’s picture

Title: Sticky flag should have impact relevance in searches » Provide additional ranking factors
Version: 5.x-0.11 » 6.x-1.x-dev

Hardcoding stickiness as a ranking factor the way you propose it probably won't be appropriate with all projects. If we want to take stickiness into account, I think we should do so through a more flexible framework for adding ranking factors. Perhaps we could integrate with the Search Ranking project (http://drupal.org/project/search_ranking).

David Lesieur’s picture

idmacdonald’s picture

Yes, integration with the Search Ranking module would be very useful. However, I just looked at the code used by that module, and the way the faceted search system builds the rankings, and it looks like it could be a fair amount of work to integrate the two. I would be interested in helping with the work, possibly, but it looks like a fairly daunting task to me at the moment.

skilip’s picture

Any progress on this?

skilip’s picture

I've managed to fix this with the following code:

/**
 * Implementation of hook_faceted_search_query_alter().
 */
function MYMODULE_faceted_search_query_alter($env, &$query) {
  array_unshift($query->orderby['default'], 'n.sticky DESC');
}
austinh7’s picture

Apologies for dragging this up from the depths but this works perfectly for me, thought others might like to know...