7

In our example, we have a Careers search feature in which we only want to match on title, job id, or a meta field such as description.

Sample Search

One wonderful feature about SXA is that you have an easy-to-use search functionality which aggregates "all" fields on the item into a computed sxacontent field. When I search for a job I would like to boost the title field over the content field due to the fact that the content tends to be more generic and possibly contain repeated words.

Imagine you are searching for a nursing position but all of the clinical jobs say "nurse" in the content. Only jobs with "nurse" in the title would be relevant.

How would I best approach this in SXA?

  • Is a new computed field required?
  • Would I need to essentially replace the search components with a new search API?

2 Answers 2

3

At the moment SXA is not using boosting but this is something we were already thinking of. So in the future, you can expect some helpers to easily configure boosting of certain fields or use customizable suggestions.

What I would suggest here is:

  • reconfigure Solr and use Spell Checking feature - there is a chance that this can solve your problem without any SXA modification but at the moment I'm not 100% sure
  • implement your own computed field reader which will use some fancy logic to read the content from the sxacontent field and will prioritize some fields over the other
1
  • I would solve this on the Solr side of things. I have not look enough into how SXA does search - eventually through ContentSearch. But - Solr has facilities to do field level dynamic boosting through the edismax query parser/handler - which makes you able to control field level querytime boosting - and these can be defined per search if needed - but we normally would define it per usecase through a dedicated request handler in Solr Commented Apr 17, 2018 at 20:01
3

A while after I originally asked the question the SXA Team added a boosting feature.

One consideration to make is that the boosting will change the sorting. If you are sorting based on Geo Location then you may see more relevant results higher in the list than those that are nearer to the search location. Using the boost would be ideal in a Site Search setup where Geo Data is not a concern.

For a given site, check under Settings where the Scope Queries are configured. Edit the boosting rule for the Scope Query.

Boosting

IIRC this feature was introduced with SXA 1.7.0. Read more about it here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.