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.
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+]