You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-commits@lucene.apache.org by Apache Wiki <wi...@apache.org> on 2008/05/15 08:01:33 UTC

[Solr Wiki] Update of "DataImportHandler" by ShalinMangar

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Solr Wiki" for change notification.

The following page has been changed by ShalinMangar:
http://wiki.apache.org/solr/DataImportHandler

The comment on the change is:
Reverted changes made by YukiDog

------------------------------------------------------------------------------
         <field name="feature" column="description" />
     </entity> 
  }}}
- The ''item_id'' foreign key in feature table is joined together with ''id'' primary key in ''item'' to retrieve rows for each row in ''item''. In a similar fashion, we join ''item'' and 'category' (which is a many-to-many relationship). Notice how we join these two tables using the intermediate table ''item_category'' again using templated SQL.  Also notice how the variable used in the ''category'' entity must include the name of each parent entity up to the root. 
+ The ''item_id'' foreign key in feature table is joined together with ''id'' primary key in ''item'' to retrieve rows for each row in ''item''. In a similar fashion, we join ''item'' and 'category' (which is a many-to-many relationship). Notice how we join these two tables using the intermediate table ''item_category'' again using templated SQL.
+ 
  {{{
   <entity name="item_category" query="select category_id from item_category where item_id='${item.id}'">
-                 <entity name="category" query="select description from category where id = '${item.item_category.category_id}'">
+                 <entity name="category" query="select description from category where id = '${item_category.category_id}'">
                      <field column="description" name="cat" />
                  </entity>
              </entity>
@@ -199, +200 @@

          <entity name="item" query="select * from item">                    
              <entity name="feature" query="select description as features from feature where item_id='${item.ID}'"/>            
              <entity name="item_category" query="select CATEGORY_ID from item_category where item_id='${item.ID}'">
-                 <entity name="category" query="select description as cat from category where id = '${item.item_category.CATEGORY_ID}'"/>                        
+                 <entity name="category" query="select description as cat from category where id = '${item_category.CATEGORY_ID}'"/>                        
              </entity>
          </entity>
      </document>
@@ -229, +230 @@

              <entity name="item_category" pk="ITEM_ID, CATEGORY_ID"
                      query="select CATEGORY_ID from item_category where ITEM_ID='${item.ID}'">
                  <entity name="category" pk="ID"
-                        query="select description as cat from category where id = '${item.item_category.CATEGORY_ID}'">                    
+                        query="select description as cat from category where id = '${item_category.CATEGORY_ID}'">                    
                  </entity>
              </entity>
          </entity>