0

according to the Solr Wiki (http://wiki.apache.org/solr/FieldCollapsing) field collapsing should be available in Solr 4. As far as I know, it is necessary to add the following configuration to the solrconfig.xml to activate field collapsing:

<searchComponent name="query"
     class="org.apache.solr.handler.component.CollapseComponent" />

I downloaded the latest nightly build apache-solr-4.0-2011-10-26_08-46-59.zip from https://builds.apache.org/job/Solr-trunk/, updated my project from lucidworks solr 3.2 to apache solr 4.x and finally found out, that the class org.apache.solr.handler.component.CollapseComponent is not available inside the apache-solr-core-4.0-2011-10-26_08-46-59.jar.

Can anyone point me to the right direction, where to find the missing components?

Best regards and thanks in advance, Tobi

javanna
  • 59,145
  • 14
  • 144
  • 125

1 Answers1

0

Solr field collapsing was released as a part of stable release 3.3
So you can use the latest 3.4 Solr stable build, which should have the components included with it.
As well, it does not require any special components to be included.
Passing group=true&group.field=some_field should have it working without any changes.

Jayendra
  • 52,349
  • 4
  • 80
  • 90
  • Thank you for this hint. I checked both version 3.3 and 3.4. Neither in 3.4 nor in 3.3 the mentioned CollapseComponent class is available inside the core jar file. On the lucene part of the solr distribution the lucene-grouping-xxx.jar is available, but not the solr grouping components. Any other ideas? – user1014617 Oct 26 '11 at 13:53
  • grouping does not need any additional components. So you can get started without any configuration changes just by passing additional query parameters. The classes for grouping have been distributed between Solr and lucene artifacts. – Jayendra Oct 26 '11 at 14:02
  • Hmm, ok the grouping should work out of the box with Solr 3.4. I tested it and tried to collapse the filed "normstufe", which is configured like this and normally has content: – user1014617 Oct 26 '11 at 14:10
  • type="string" indexed="true", stored="true". The analysis of the query looks like this: webapp=/search path=/select params={fl=*,score&start=0&q=*:*&group.field=normstufe&group=true&wt=xml&rows=20&version=2.2} hits=982 status=0 QTime=109. During the search I am getting an exception: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[3,91060] Message: error reading value:LST at org.apache.solr.client.solrj.impl.XMLResponseParser.readArray(XMLResponseParser.java:324). I am stuck. – user1014617 Oct 26 '11 at 14:17
  • group=true&group.field=normstufe should return grouped values. normstufe should be an indexed field. Are you using Solrj client ? – Jayendra Oct 26 '11 at 14:17
  • Yes, the exception is trown in my Java source code, when I am trying queryResponse.getResults(). Using the admin user interface of Solr I can see, that the result has grouping information but no normal search result is visible. Does this mean I have to trigger two search requests? One for the grouping and one for the search itself? Is there any Solrj API function to retrieve the grouping information in an easy way? It seems queryResponse.getResponse() will do the job, right? – user1014617 Oct 26 '11 at 14:26
  • Sorry, wrong information: I am getting the Exception during search itself: solrServer.query(myQuery); as soon as I am adding the parameters group=true and group.field=normstufe to the query. So maybe the SolrJ API is not capable of dealing with the grouping response?! – user1014617 Oct 26 '11 at 14:42
  • To retrieve grouped results, you need other handling. Check for thread http://www.lucidimagination.com/search/document/a8b48caf3e7f1a2b/solrj_collapsable_query_fails#a8b48caf3e7f1a2b – Jayendra Oct 26 '11 at 15:58
  • Hello all, I tested it and it is working like a charme. Thanks! :-) – user1014617 Nov 03 '11 at 08:22
  • Cool ... if the answer helped. you might want to accept the answer. – Jayendra Nov 03 '11 at 08:24