How to get the forum search to sort by 'Relevance' by default

  • Time
  • Show
Clear All
new posts
  • bigbear83
    New Member
    • Nov 2015
    • 11
    • 5.1.x

    How to get the forum search to sort by 'Relevance' by default

    This must be a very simple edit somewhere but for the life of me I've spent hours trying to figure this w/o any results. Could someone kindly point me in the right direction?

    Basically this is what I'm looking for-

    When a user makes a search on the forums from the main page (not the advanced search page)

    The search results always defaults to sort by "Date - last update"

    I really need this to sort by "Relevance" by default ... is there any way to do this at all? What am I missing here?

    I suspect this must be a very simple edit somewhere that I am totally missing here but I'm not entirely sure what it is...

    I'm running the latest vB 5.2.1

    Any help I can get regarding my issue here would be greatly appreciated! Many thx in advance
  • Mark.B
    vBulletin Support
    • Feb 2004
    • 24275
    • 6.0.X

    This would require code customisations to achieve, there is no way to do this in the default software.

    It would be worth asking at, the modification and customisation site.
    vBulletin Support
    My Unofficial vBulletin 6.0.0 Demo:
    My Unofficial vBulletin Cloud Demo:


    • glennrocksvb
      Former vBulletin Developer
      • Mar 2011
      • 3955
      • 5.7.X

      You can do this via template hook. Create a template hook at footer_before_body_end hook location with the following template code.

      (function($) {
          $(window).on('load', function() {
              $('#searchForm').on('submit.searchform', function() {
                  var $searchJson = $('#header input[name="searchJSON"]'),
                      decodedJson = decodeURIComponent($searchJson.val()),
                  try {
                      parsedJson = $.parseJSON(decodedJson);
                      parsedJson.sort = 'relevance';
      If you don't know how to create a template hook, follow one of my mods in my signature below. The instructions should be similar.

      Flag Icon Postbit Insert GIPHY Impersonate User INITIALS AVATAR Better Name Card Quote Selected Text Collapsed PM Post Footer Translate Stop Links in Posts +MORE!


      • bigbear83
        New Member
        • Nov 2015
        • 11
        • 5.1.x

        Glenn Vergara sweet! Thx a ton for that ... works a treat!


        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.