[ https://issues.apache.org/jira/browse/SOLR-1682?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martijn van Groningen updated SOLR-1682: ---------------------------------------- Attachment: SOLR-1682_prototype.patch I checked out the patch and I had to make a two changes to make it working (the new patch attached contains the changes): * In the buildSet method i changed the comparator to this: {code} Comparator<SearchGroup1> comparator = new Comparator<SearchGroup1>() { public int compare(SearchGroup1 o1, SearchGroup1 o2) { int comp = fc.compare(o1.comparatorSlot, o2.comparatorSlot); if (comp != 0) { return comp; } if (o1.topDoc < o2.topDoc) { return 1; } else if (o1.topDoc > o2.topDoc) { return -1; } return 0; } }; {code} In cases where the sorting value was the same, collapse groups were lost (I was using the all query). This is the behavioir of TreeSet when the comparator returns 0. * When no sorting is specified a NPE occured. I temporarly fixed this by adding the following code in the groupBy method before the fieldComparator is initialized: {code} if (cmd.sort == null) { cmd.sort = new Sort(new SortField("score", SortField.SCORE, true)); } {code} I also saw the following todo in the code: bq. these aren't valid if the group is every discarded then re-added. keep track if there have been discards? I think this means that we have to keep all groups in memory. The cost is increase of the memory footprint, but we then do get accurate collapse counts. This change can be put in a different implementation off course. Also we need to find a way of adding the collapse information to the response in a nice manner. I assume we still want the use the response format Shalin suggested? It does differ from the response the patch is currently generating. > Implement CollapseComponent > --------------------------- > > Key: SOLR-1682 > URL: https://issues.apache.org/jira/browse/SOLR-1682 > Project: Solr > Issue Type: Sub-task > Components: search > Reporter: Martijn van Groningen > Assignee: Shalin Shekhar Mangar > Fix For: Next > > Attachments: field-collapsing.patch, SOLR-1682.patch, > SOLR-1682.patch, SOLR-1682_prototype.patch, SOLR-1682_prototype.patch, > SOLR-236.patch > > > Child issue of SOLR-236. This issue is dedicated to field collapsing in > general and all its code (CollapseComponent, DocumentCollapsers and > CollapseCollectors). The main goal is the finalize the request parameters and > response format. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org