Sort by first value being a exact match

I’m building a book recommendation system, but i’m intrigued by a thing i wanted to do. When the results show, i want to give 3 book recomendations of the selected genre, the first one being the exact match with the selected book lenght, but the other 2 results being from other book lenght.

Ex: The 3 books have the Romance genre, but the first is Short, the one of my choice, and the other 2 are long and/or medium.

Trying things out with text metadata, but no results until now.


params takes the parameters passed from another page and uses them as filters.