Actually in this case I am sorting by score already but I'm not sure if that 
helps.  Regardless of how I do my primary sort, I want to tweak the results 
such that some hardcoded number of documents that match some criteria get 
pushed or frontloaded to the top of the results.  For instance think of a 
search engine where you generally are displaying a list of pages sorted by 
score, but you want 10 pages from a featured site to always show at the top of 
the first page, while leaving the rest of the sort order as it is.  That's why 
it's not something I can really do at the index stage by assigning boosts - I 
only want to boost those first 10 items that match the criteria, not all of 
them.

What I'm doing now is taking the whole resulting document collection, iterating 
through it and manually moving these 10 documents to the front of the 
collection.  This is slow and ugly.  I was hoping there might be a slicker way 
to do it as part of the actual sort.  I will play around with the custom 
sorting and report back if I figure out an elegant way to do it.

Thanks for all your replies.
Raymond
--
Sent from the Lucene - Java Users forum at Nabble.com:
http://www.nabble.com/custom-sort-t262833.html#a750675

Reply via email to