I need to sort the faces that are returned from SOLR by relevance

I have my SOLR index song objects that belong to a higher level album object. An example is shown below:

<song>
<album title>Blood Sugar Sex Magic</album title>
<song title>Under the Bridge</song title>
<description>A sad song about junkies</description>
</song>

What I can do right now is to create a line in the album title so that the song search also shows me which albums contain the hits for this keyword.

The default behavior for SOLR is that faces are displayed in the order of the largest number of names. However, what I want to achieve is a list of facets that will be sorted according to the relevance of the top hit for this album.

For example, a search for the word “sad” can show a one-hit facet for “Blood Sugar Sex Magic,” and there might also be an album called “Sad Clown Songs,” with 10 hits. “Clown’s sad songs” will be featured as the first aspect, although it may be that “Under the Bridge” appears as the most important song.

My question is, how can I get all the faces back, but then arrange them according to the relevance of the songs within them? If I need to change or extend some basic SOLR code, what would it be?

Thanks in advance.

+5
source share

All Articles