We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20159
    • 26 Posts
    Hi,

    I’m using AjaxSearch on a site and it works OK.

    However, I would like to know more about how the results are ranked.

    Specifically, if a search word is contained within the page’s Longtitle or Title I would like that result at the top. This is not necessarily the case at the moment, with words appearing in a page’s body appearing higher than those where it is in Longtitle or Title.

    Does someone have a solution to this?

    Many thanks in advance.
      • 5811
      • 1,717 Posts
      With the version 1.7.1 results are not sorted by "number of words found".

      With the version 1.8.0 in preparation (coming soon), you could adjust the ranking as follow:

      rank : define the ranking of search results

      &rank=`comma separated list of fields with optionaly user defined weight`

      The fields should be searcheable fields from main table or joined tables
      by default: &rank=`pagetitle:100,extract`

      The rank is a calculated value used to sort the results. This value is function of
      number of search term found and optionaly of a specified user weight.

      e.g: &rank=`pagetitle:100,extract`
      rank[’pagetitle’] = nb_search_terms_found * 100
      rank[’extract’] = nb_search_terms_found * 1

      Results are sorted with the rank values.
      For instance, a document with a search term found in the pagetitle, and 6 terms found
      in the extract will have a rank of 106.

      e.g: &rank=`pagetitle,extract`
      rank[’pagetitle’] = nb_search_terms_found * 1
      rank[’extract’] = nb_search_terms_found * 1

      The rank parameter will run also with your own non-Modx tables and you could display the value to the end user by using [+as.rank+]
        • 5811
        • 1,717 Posts
        The rank parameter is now available with the 1.8 version.
          • 5811
          • 1,717 Posts
          A demo and explanations about the use of &order and &rank parameter is now available here.

          Look at the rankAjaxResultTpl (download it from the site) to understand how are displayed the rank value and the publishon date.
          If any question or remarks don’t hesitate ...