: I am trying to index a collection that has child documents. I have : successfully loaded the data into my index using SolrJ, and I have : verified that I can search correctly using the "child of" method in my : fq variable. Now, I would like to use Velocity (Solritas) to display : the parent records with some details of the child records underneath. : Is there an easy way to do this? Is there an example somewhere that I : can look at?
Step #1 is to forget about velocity and focus on getting the data you want about the children into the response. To do that you'll need to use the [child] DocTransformer... https://cwiki.apache.org/confluence/display/solr/Transforming+Result+Documents ala... fl=id,[child parentFilter=doc_type:book childFilter=doc_type:chapter limit=100] If you are using this in conjunction with a block join query, you can use local params to eliminate some redundency... q=some_parent_field:foo parents=content_type:parentDoc fq={!parent which=$parents}child_field:bar fl=id,[child parentFilter=$parents childFilter=content_type:childDoc limit=100] Step #2: once you have the children in the response data, then you can use velocity to access each of the children of the docs that match your query via SolrDocument.getChildDocuments() -Hoss http://www.lucidworks.com/