Thank you for the prompt reply jason. The group.offset parameter is working for me, now I can iterate through all items for each company. The problem I'm having right now is pagination. Is there a way how this can be implemented out of the box with solr?
Before I was using the group.main=true for easy pagination of results, but it seems like I'll have to ditch that and use the standard grouping format returned by solr for the group.offset parameter to be useful. Since all groups don't have the same number of items, I'll have to carefully calculate the results that should be returned for each page of 20 items and probably make several solr calls per page rendered. On Thu, May 9, 2013 at 1:07 PM, Jason Hellman < jhell...@innoventsolutions.com> wrote: > Luis, > > I am presuming you do not have an overarching grouping value here…and > simply wish to show a standard search result that shows 1 item per company. > > You should be able to accomplish your second page of desired items (the > second item from each of your 20 represented companies) by using the > group.offset parameter. This will shift the position in the returned array > of documents to the value provided. > > Thus: > > group.limit=1&group.field=companyid&group.offset=1 > > …would return the second item in each companyid group matching your > current query. > > Jason > > On May 9, 2013, at 10:30 AM, Luis Carlos Guerrero Covo < > lcguerreroc...@gmail.com> wrote: > > > Hi, > > > > I'm using solr to maintain an index of items that belong to different > > companies. I want the search results to be returned in a way that is fair > > to all companies, thus I wish to group the results such that each company > > has 1 item in each group, and the groups of results should be returned > > sorted by score. > > > > example: > > ---------------------- > > > > 20 companies > > > > first 100 results > > > > 1-20 results - (company1 highest score item, company2 highest score item, > > etc..) > > 20-40 results - (company1 second highest score item, company 2 second > > highest score item, etc..) > > ... > > > > ---------------------- > > > > I'm trying to use the field collapsing feature but I have only been able > to > > create the first group of results by using > > group.limit=1,group.field=companyid. If I raise the group.limit value, I > > would be violating the 'fairness rule' because more than one result of a > > company would be returned in the first group of results. > > > > Can I achieve the desired search result using SOLR, or do I have to look > at > > other options? > > > > thank you, > > > > Luis Guerrero > > -- Luis Carlos Guerrero Covo M.S. Computer Engineering (57) 3183542047