Dear Wiki user, You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.
The "FieldCollapsing" page has been changed by martijn. The comment on this change is: Updated the example responses. http://wiki.apache.org/solr/FieldCollapsing?action=diff&rev1=13&rev2=14 -------------------------------------------------- <<Anchor(examples)>> = Examples = - The latest patch has an improved response format. The first two examples are valid for patches before 2009-11-11 and the last example is valid for patches from that date. - Using the example data: - Collapse all documents using 'cat' and 'normal' collapse type: + Collapse all documents using 'manu_exact' and 'normal' collapse type: - - http://localhost:8983/solr/select/?q=*:*&collapse.field=cat&collapse.threshold=1&collapse.type=normal + http://localhost:8983/solr/select/?q=*:*&collapse.field=manu_exact&collapse.threshold=1&collapse.type=normal - {{{ <lst name="collapse_counts"> - <int name="hard">1</int> - <int name="electronics">2</int> - <int name="memory">2</int> - <int name="monitor">1</int> - <int name="software">1</int> - </lst> - }}} - http://localhost:8983/solr/select/?q=*:*&collapse.field=cat&collapse.threshold=1&collapse.type=adjacent - - {{{ - <lst name="collapse_counts"> - <int name="hard">1</int> - <int name="electronics">1</int> - <int name="memory">2</int> - <int name="monitor">1</int> - </lst> - }}} - http://localhost:8983/solr/select/?q=*:*&collapse.field=cat&collapse.threshold=1&collapse.type=adjacent - - {{{ - <lst name="collapse_counts"> - <str name="field">cat</str> + <str name="field">manu_exact</str> <lst name="results"> + <lst name="F8V7067-APL-KIT"> - <lst name="233238"> - <str name="fieldValue">hard</str> <int name="collapseCount">1</int> + <str name="fieldValue">Belkin</str> </lst> - <lst name="244438"> + <lst name="TWINX2048-3200PRO"> + <int name="collapseCount">3</int> - <str name="fieldValue">electronics</str> + <str name="fieldValue">Corsair Microsystems Inc.</str> + </lst> + <lst name="VDBDB1A16"> <int name="collapseCount">1</int> + <str name="fieldValue">A-DATA Technology Inc.</str> </lst> - <lst name="234658"> + <lst name="0579B002"> - <str name="fieldValue">memory</str> - <int name="collapseCount">2</int> + <int name="collapseCount">1</int> + <str name="fieldValue">Canon Inc.</str> </lst> - <lst name="984338"> + <lst name="SOLR1000"> - <str name="fieldValue">monitor</str> <int name="collapseCount">1</int> + <str name="fieldValue">Apache Software Foundation</str> </lst> </lst> </lst> }}} + + Collapse all documents using 'manu_exact' and 'adjacent' collapse type: + http://localhost:8983/solr/select/?q=*:*&collapse.field=manu_exact&collapse.threshold=1&collapse.type=adjacent + + {{{ + <lst name="collapse_counts"> + <str name="field">manu_exact</str> + <lst name="results"> + <lst name="F8V7067-APL-KIT"> + <int name="collapseCount">1</int> + <str name="fieldValue">Belkin</str> + </lst> + <lst name="TWINX2048-3200PRO"> + <int name="collapseCount">1</int> + <str name="fieldValue">Corsair Microsystems Inc.</str> + </lst> + <lst name="TWINX2048-3200PRO-payload"> + <int name="collapseCount">1</int> + <str name="fieldValue">Corsair Microsystems Inc.</str> + </lst> + </lst> + </lst> + }}} + - The response is now centred around collapse groups. A collapse group represents documents that were collapsed during the search. A collapse group is identifier by the most relevant document of that collapse group, which is document that did not get collapsed and remained present in the search result. So the ids like 233238 are from documents that are also present in the search result. + The response is centred around collapse groups. A collapse group represents documents that were collapsed during the search. A collapse group is identifier by the most relevant document of that collapse group, which is document that did not get collapsed and remained present in the search result. So the ids like 233238 are from documents that are also present in the search result. = Distributed field collapsing = In a distributed environment fieldcollapsing is supported in a limited manner. While indexing you must make sure that the documents of a collapse group are not scattered across different shards. Documents of a collapse group must reside on the same shard, failing to do so will corrupt your search results. Doing a distributed search with collapsing requires not extra parameters to be send with the request. For example the following request is sufficient: http://localhost:8080/solr/select/?q=solr&field.collapse=my_field&shards=localhost:55527/solr,localhost:55529/solr
