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

Vadim Kirilchuk edited comment on SOLR-3076 at 5/17/13 7:55 AM:
----------------------------------------------------------------

Tom, you can take a look at AddBlockUpdateTest, it contains several examples. 
Here SOLR-3076 and SOLR-3076-childDocs have a great difference: 

here is SOLR-3076 style (Note: child documents inside fields):
{code:xml}
<add>
  <doc>
    <field name='id'>1</field>
    <field name='type_s'>parent</field>
    <field name='make_name_s'>Ford</field>
    <field name="1th-subdocs">
      <doc> 
          <field name='id'>2</field>
          <field name='type_s'>child</field>
          <field name='modelyear_name_s'>1992 Ford E150 Van 2WD</field>
      </doc>
      <doc> 
          <field name='id'>3</field>
          <field name='type_s'>child</field>
          <field name='modelyear_name_s'>1992 Ford E150 Van 2WD</field>
      </doc>
    </field>
    
    <!-- 
        This was done for case when you have more then 2 types in relation:for 
example, Make->Model and Make->Factory 
        However, it is ok to just add all subdocs to 1th-subdocs fields.
    -->
    <field name="2th-subdocs"> 
      <doc> 
          ...
      </doc>
    </field>
  </doc>
  
  <doc> 
       ...
  </doc>
</add>
{code}

here is SOLR-3076-childDocs style (Note: child documents are another doc inside 
doc):
{code:xml}
<add>
  <doc>
    <field name='id'>1</field>
    <field name='type_s'>parent</field>
    <field name='make_name_s'>Ford</field>
    <doc>
      <field name='id'>2</field>
      <field name='type_s'>child</field>
      <field name='modelyear_name_s'>1992 Ford E150 Van 2WD</field>
    </doc>
    <doc>
      <field name='id'>3</field>
      <field name='type_s'>child</field>
      <field name='modelyear_name_s'>1992 Ford E150 Van 2WD</field>
    </doc>
    
   <!-- 
        2th-subdocs from previous example can easily go here.
    -->
    <doc>
      ...
    </doc>
  </doc>
</add>
{code}

Also i suggest you to use SolrJ instead of plain xml, examples at 
https://github.com/griddynamics/solr-fork/blob/trunk-patched/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
 look at testSolrJXML()
                
      was (Author: vkirilchuk):
    Tom, you can take a look at AddBlockUpdateTest, it contains several 
examples. 
Here SOLR-3076 and SOLR-3076-childDocs have a great difference: 

here is SOLR-3076 style (Note: child documents inside fields):
{code:xml}
<add>
  <doc>
    <field name='id'>1</field>
    <field name='type_s'>parent</field>
    <field name='make_name_s'>Ford</field>
    <field name="1th-subdocs">
      <doc> 
          <field name='id'>2</field>
          <field name='type_s'>child</field>
          <field name='modelyear_name_s'>1992 Ford E150 Van 2WD</field>
      </doc>
      <doc> 
          <field name='id'>3</field>
          <field name='type_s'>child</field>
          <field name='modelyear_name_s'>1992 Ford E150 Van 2WD</field>
      </doc>
    </field>
    
    <!-- 
        This was done for case when you have more then 2 types in relation:for 
example, Make->Model and Make->Factory 
        However, it is ok to just add all subdocs to 1th-subdocs fields.
    -->
    <field name="2th-subdocs"> 
      <doc> 
          ...
      </doc>
    </field>
  </doc>
  
  <doc> 
       ...
  </doc>
</add>
{code:xml}

here is SOLR-3076-childDocs style (Note: child documents are another doc inside 
doc):
{code:xml}
<add>
  <doc>
    <field name='id'>1</field>
    <field name='type_s'>parent</field>
    <field name='make_name_s'>Ford</field>
    <doc>
      <field name='id'>2</field>
      <field name='type_s'>child</field>
      <field name='modelyear_name_s'>1992 Ford E150 Van 2WD</field>
    </doc>
    <doc>
      <field name='id'>3</field>
      <field name='type_s'>child</field>
      <field name='modelyear_name_s'>1992 Ford E150 Van 2WD</field>
    </doc>
    
   <!-- 
        2th-subdocs from previous example can easily go here.
    -->
    <doc>
      ...
    </doc>
  </doc>
</add>
{code}

Also i suggest you to use SolrJ instead of plain xml, examples at 
https://github.com/griddynamics/solr-fork/blob/trunk-patched/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
 look at testSolrJXML()
                  
> Solr should support block joins
> -------------------------------
>
>                 Key: SOLR-3076
>                 URL: https://issues.apache.org/jira/browse/SOLR-3076
>             Project: Solr
>          Issue Type: New Feature
>            Reporter: Grant Ingersoll
>             Fix For: 5.0, 4.4
>
>         Attachments: 27M-singlesegment-histogram.png, 27M-singlesegment.png, 
> bjq-vs-filters-backward-disi.patch, bjq-vs-filters-illegal-state.patch, 
> child-bjqparser.patch, dih-3076.patch, dih-config.xml, 
> parent-bjq-qparser.patch, parent-bjq-qparser.patch, Screen Shot 2012-07-17 at 
> 1.12.11 AM.png, SOLR-3076-childDocs.patch, SOLR-3076.patch, SOLR-3076.patch, 
> SOLR-3076.patch, SOLR-3076.patch, SOLR-3076.patch, SOLR-3076.patch, 
> solrconf-bjq-erschema-snippet.xml, solrconfig.xml.patch, 
> tochild-bjq-filtered-search-fix.patch
>
>
> Lucene has the ability to do block joins, we should add it to Solr.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to