: problem becomes from MoreLikeThis behaviour. As you probably know that Solr : feature only suggests similar components by the first - and only - document : returned from the original query. That is if you have a query that returns : 5 documents (a query with five IDs with OR boolean clauses, like before) : MoreLikeThis only returns similar documents for the first one.
that's how the MLT *Handler* works, but if you use the MLT *component* it will give you N docs similar to *each* doc in the response... http://wiki.apache.org/solr/MoreLikeThis So using the 3.5 example configs/data... http://localhost:8983/solr/select?q=memory&mlt=true&mlt.count=2&rows=5&mlt.fl=manu,cat&mlt.mindf=1&mlt.mintf=1&fl=id,score ...that gives me the fist 5 results matching my query, and for each of those 5 results, i get the top 2 results "like" each of the individual documents from my main result). : etc. So now I have to merge the results but, hey! Imagine that you receive : a sort by Date. You have to compose the final response with the merged : similar documents and sort it by Date. Thats a problem, right? So I do the : following: So it sounds like you want a "more like these" type search ... if query Q matchines some set of docs, you want to take the first N docs, and then generate a list of M docs similar to those N as a whole? If i'm understanding correctly, then you might find it easier/better to tweak your alogorithm so that you continue to use the MLT *handler* for each of your N main docs but instead of looking at the MLT response docs, you use mlt.interestingTerms=true and gather up all of the interesting terms, then issue one single query where you search for all of those interesting terms and see what final set of documents you get back. As for your original problem (assuming neither of those previous comments ar helpful).... : The number of documents is not important. Imagine that you have a rows=20, : so N=20 and you have and array of 20 similar components ordered correctly : from most important to less important. Returning to the sorting problem, if : you launch another and final query to Solr with q=(all the similar document : IDs ordered) you can append the original sorting by Date, so the results : can be sorted by Date, or by other field, or just without order... and : that´s the problem! ...the easiest way i can think of to deal with this is to ignore the sort completely. you're asking for all the docs you want by id and setting rows big enough to get them all at once so you know they will all be returned on page one, and you know thye have a uniqueKey field (you are quering on it) so just make sure "id" in in your "fl" param when you get them all back, look at the "id" field and order them they way you want in your client code. -Hoss