Search boosting - again


#1

Enonic version: 7.0.2
OS: Linux

Is it possible to boost specific content types on query results?
I need each content type having a different weight, for example:

  • article: 0.75
  • folder: 0.5
  • report: 0.25
  • attachment: 0.125

Those values above would, then, increase the relevance on _score final value.

After some research, I’ve run out of approaches to solve my problem.

  1. Enonic query language doesn’t support mathematical operations, so I cannot multiply my constant values to actual _score value and sort by it.
  2. The only ordering function is geoDistance(), and we have not some way to implement a custom function that uses my weights.
  3. The index of content type on query params, like in contentLib.query({ contentTypes: [‘type1’, ‘type2’, ‘type3’] }) or in contentLib.query({ query: “type = ‘type1’ or type = ‘type2’ or type = ‘type3’” }), do not results on different _score values for results.