We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16867
    • 10 Posts
    I’m trying to make a system for my writers to heavily weight certain documents in the search results. For example, if they know that a document absolutely must be the top result for a certain search term (say, "tour"), they can add "tour" to a custom TV (i created one called ’searchKeyword’) that I then weight very strongly in the results.

    However, that template variable seems to have no noticeable effect on the order of search rankings for the AJAX search results when I’m using &rank.

    Here’s the AjaxSearch snippet call I’m using:

    [!AjaxSearch? &moreResultsPage=`8` &ajaxMax=`12` &parents=`1` &rank=`searchKeyword:100,longtitle:25,pagetitle:10,description:10,extract` &extractLength=`150` &showMoreResults=`1` &tplLayout=`home-search_layout` &tplAjaxResult=`result_item` !]


    When I change the &rank weights for any of the standard TVs (longtitle,pagetitle, etc.), it definitely makes a difference in the order of results. But it’s seems to completely ignore the ’searchKeyword’ variable. If I change the weight for it or remove it completely it makes no difference.

    Am I perhaps missing something? Do I need to do anything special to look at custom TVs? I’ve tried the new &whereSearch parameter and that doesn’t seem to help either.

    The custom template variable ’searchKeyword’ is just a plain text field assigned to all document templates.

    This is with AjaxSearch 1.8.1 (though I had the same problem with 1.8.0) on ModX 0.9.6.2 (with PHP 5.2.5 and MySQL 5.0.67)