Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

    Leave a comment:


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

    Code:
    <script>
    (function($) {
        $(window).on('load', function() {
            $('#searchForm').on('submit.searchform', function() {
                var $searchJson = $('#header input[name="searchJSON"]'),
                    decodedJson = decodeURIComponent($searchJson.val()),
                    parsedJson;
    
                try {
                    parsedJson = $.parseJSON(decodedJson);
                    parsedJson.sort = 'relevance';
                    $searchJson.val(JSON.stringify(parsedJson));
                }
                catch(e){}
                
            });
        });
    })(jQuery);
    </script>
    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.

    Leave a comment:


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

    It would be worth asking at www.vbulletin.org, the modification and customisation site.

    Leave a comment:


  • 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
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X