Hi,

we have a requirement for one of our search results which has a quite complex 
sorting strategy. Let me explain the document first, using an example:

The document is a book. It has several indexed text fields: Title, Author, 
Distributor. It has two integer columns, where one reflects the number of sold 
copies (num_copies), and the other reflects
the number of comments on the website (num_comments).

The Requirement for the relevancy looks like this:

* Documents which have exact matches in the "Author" field, should be ranked 
highest, disregarding their values in "num_copies" and "num_comments" fields  
* After the exact matches, the sorting should be based on the value in the 
field "num_copies", but only for documents, where this field is set
* After the num_copies matches, the sorting should be based on "num_comments"

I'm wondering is this kind of sort order can be implemented in a single query, 
or if i need to break it down into several queries and merge the results on 
application level.

-robert


Reply via email to