I really need this on Solr, but thought I would start here as I suspect that, if it's possible, it's some kind of custom relevancy ranking that would need to be done in lucene and then used in SOLR. I will simplify the actual problem somewhat, but I think it will have the gist of what I want to do.
Assume I have a bunch of documents which have a text field and a keyword field. The text field is just ordinary text. The keyword field has a limited number of values (may be in the hundreds) and there is only a single keyword per document. For discussion purposes, let's assume that the keyword is a document type like "mail", "blog", "website", etc. So someone searches for "dog". I want to display a list of documents with "dog" in the text field. That's easy of course. But, I want to limit it so that for each page of results displayed, if there are multiple document types for the search result, then only a certain number of documents of each type get displayed. For example, if I display of 20 results, I might want to limit it to a maximum of 10 "mail", 10 "blog" and 10 "website" documents. Which ones get displayed and how they were ordered would depend on the normal relevancy ranking, but, for example, once I had 10 "mail" objects to display on the page, the effect would be that other "mail" objects relevancy would drop below "blog" and "website". If there aren't 10 of one of these, then the I'm allowed to exceed the maximum of 10 so that I get 20 results. What I don't want is 20 "mail" documents if there are "blog" and/or "website" documents to display. Is something like this even possible? Any thoughts would be appreciated. Scott