I want to define a custom search ranking, and only use it on a special page, without affecting the regular search feature.

Looking at the code in node.module, I see how I could hook MODULE_ranking() in a custom module, however it won't be applied to the query unless global variable node_rank_X setting is enabled in the global config.

I could munge the global $conf for my one specific page, but this seems ugly. Is there a more sensible way to approach this?


Search API was built to give a great deal of flexibility to searches. You can create separate search indexes to meet different criteria, weight individual fields differently per index and keep all of your configuration managed in the UI, versus trying to write custom logic into MODULE_ranking().

Download Search API, install and configure your indexes at: /admin/config/search/search_api

| improve this answer | |
  • In the end, I still can't get quite the functionality from Search API that I wanted, but I suspect your answer is about as good as it gets without writing custom code. – dataless Apr 11 '14 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.