[ 
https://issues.apache.org/jira/browse/SOLR-5285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13783101#comment-13783101
 ] 

Mikhail Khludnev commented on SOLR-5285:
----------------------------------------

Hello Varun,

You can experiment with the following code:

{code}
@Override
public void transform(SolrDocument doc, int docid) throws IOException{
  parentid = doc.getField("id");
  children = searcher.getDocList(
      QParser.getParser("{!child 
of=content_type:parentDocument}id:"+parentid).getQuery(),...);
  doc.put("children", children);
}

{code}
 

> Solr response format should support child Docs
> ----------------------------------------------
>
>                 Key: SOLR-5285
>                 URL: https://issues.apache.org/jira/browse/SOLR-5285
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Varun Thacker
>             Fix For: 5.0, 4.6
>
>
> Solr has added support for taking childDocs as input ( only XML till now ). 
> It's currently used for BlockJoinQuery. 
> I feel that if a user indexes a document with child docs, even if he isn't 
> using the BJQ features and is just searching which results in a hit on the 
> parentDoc, it's childDocs should be returned in the response format.
> [~hossman_luc...@fucit.org] on IRC suggested that the DocTransformers would 
> be the place to add childDocs to the response.
> Now given a docId one needs to find out all the childDoc id's. A couple of 
> approaches which I could think of are 
> 1. Maintain the relation between a parentDoc and it's childDocs during 
> indexing time in maybe a separate index?
> 2. Somehow emulate what happens in ToParentBlockJoinQuery.nextDoc() - Given a 
> parentDoc it finds out all the childDocs but this requires a childScorer.
> Am I missing something obvious on how to find the relation between a 
> parentDoc and it's childDocs because none of the above solutions for this 
> look right.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to