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

Varun Thacker commented on SOLR-5285:
-------------------------------------

I don't think I have been to able to explain the problem accurately in the Jira 
description. Let me try again..

1. Index docs with childDocs. So let's take the example on 
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-BlockJoinQueryParsers

2. Now I query 
http://localhost:8983/solr/collection1/select?q=*:*&fq=content_type:%22parentDocument%22

3. This is the response

{code}<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">2</int>
        <lst name="params">
            <str name="q">*:*</str>
            <str name="fq">content_type:"parentDocument"</str>
        </lst>
    </lst>
<result name="response" numFound="2" start="0">
    <doc>
        <str name="id">1</str>
        <arr name="title">
        <str>Solr adds block join support</str>
        </arr>
        <arr name="content_type">
            <str>parentDocument</str>
        </arr>
        <long name="_version_">1447311301175934976</long>
    </doc>
    <doc>
        <str name="id">3</str>
        <arr name="title">
            <str>Lucene and Solr 4.5 is out</str>
        </arr>
        <arr name="content_type">
            <str>parentDocument</str>
        </arr>
        <long name="_version_">1447311327665061888</long>
    </doc>
</result>
</response>
{code}

4. Ideally I would want this as my response:
{code}
<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">2</int>
        <lst name="params">
            <str name="q">*:*</str>
        </lst>
    </lst>
<result name="response" numFound="4" start="0">
<doc>
    <str name="id">1</str>
    <arr name="title">
        <str>Solr adds block join support</str>
    </arr>
    <arr name="content_type">
        <str>parentDocument</str>
    </arr>
    <long name="_version_">1447311301175934976</long>
    <doc>
        <str name="id">2</str>
        <str name="comments">SolrCloud supports it too!</str>
    </doc>
</doc>

<doc>
    <str name="id">3</str>
    <arr name="title">
        <str>Lucene and Solr 4.5 is out</str>
    </arr>
    <arr name="content_type">
        <str>parentDocument</str>
    </arr>
    <long name="_version_">1447311327665061888</long>
    <doc>
        <str name="id">4</str>
        <str name="comments">Lots of new features</str>
    </doc>
</doc>
</result>
</response>
{code}


Also [~mkhludnev] ,
bq. approach no 1. seems never fitting, because the relation is already present 
in the index
 how is the relation already present in the index? From what I understand each 
child doc has a _root_ field which points to the parent doc. But we do not have 
the opposite relation. To implement this feature we would need the relation b/w 
each parent and all it's child doc right? Am I missing anything?

> 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