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 07:32:52 UTC

[Solr Wiki] Update of "DataImportHandler" by YukiDog

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 YukiDog:
http://wiki.apache.org/solr/DataImportHandler

------------------------------------------------------------------------------
              <entity name="feature" query="select description from feature where item_id='${item.ID}'">
                  <field name="features" column="description" />
              </entity>
-             <entity name="item_category" query="select category_id from item_category 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 from category where id = '${item_category.CATEGORY_ID}'">
+                 <entity name="category" query="select description from category where id = '${item.item_category.CATEGORY_ID}'">
                      <field column="description" name="cat" />
                  </entity>
              </entity>
@@ -179, +179 @@

         <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.
+ 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. 
  {{{
   <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_category.category_id}'">
+                 <entity name="category" query="select description from category where id = '${item.item_category.category_id}'">
                      <field column="description" name="cat" />
                  </entity>
              </entity>
@@ -198, +198 @@

      <document>
          <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="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_category.CATEGORY_ID}'"/>                        
+                 <entity name="category" query="select description as cat from category where id = '${item.item_category.CATEGORY_ID}'"/>                        
              </entity>
          </entity>
      </document>
@@ -229, +229 @@

              <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_category.CATEGORY_ID}'">                    
+                        query="select description as cat from category where id = '${item.item_category.CATEGORY_ID}'">                    
                  </entity>
              </entity>
          </entity>

Fwd: [Solr Wiki] Update of "DataImportHandler" by YukiDog

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Hello,

If you find a problem with DataImportHandler or the wiki documentation, then
please do report it back in the mailing list so that we may have a chance to
verify your problem and propose solutions. It may help us improve the tool
as well as the documentation.

In the wiki edit below, the changes were actually incorrect so I've reverted
them. The variables used do not need to include any entity's name except for
the entity to which they belong. If you observe something different, it may
be a bug or the usage maybe incorrect. For example:

This does not work -- "select description as cat from category where id =
'${item.item_category.CATEGORY_ID}"
This works correctly -- "select description as cat from category where id =
'${item_category.CATEGORY_ID}"

Thanks!

---------- Forwarded message ----------
From: Apache Wiki <wi...@apache.org>
Date: Thu, May 15, 2008 at 11:02 AM
Subject: [Solr Wiki] Update of "DataImportHandler" by YukiDog
To: solr-commits@lucene.apache.org


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 YukiDog:
http://wiki.apache.org/solr/DataImportHandler

------------------------------------------------------------------------------
             <entity name="feature" query="select description from feature
where item_id='${item.ID}'">
                 <field name="features" column="description" />
             </entity>
-             <entity name="item_category" query="select category_id from
item_category 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 from
category where id = '${item_category.CATEGORY_ID}'">
+                 <entity name="category" query="select description from
category where id = '${item.item_category.CATEGORY_ID}'">
                     <field column="description" name="cat" />
                 </entity>
             </entity>
@@ -179, +179 @@

        <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.
+ 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.
 {{{
  <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_category.category_id}'">
+                 <entity name="category" query="select description from
category where id = '${item.item_category.category_id}'">
                     <field column="description" name="cat" />
                 </entity>
             </entity>
@@ -198, +198 @@

     <document>
         <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="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_category.CATEGORY_ID}'"/>
+                 <entity name="category" query="select description as cat
from category where id = '${item.item_category.CATEGORY_ID}'"/>
             </entity>
         </entity>
     </document>
@@ -229, +229 @@

             <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_category.CATEGORY_ID}'">
+                        query="select description as cat from category
where id = '${item.item_category.CATEGORY_ID}'">
                 </entity>
             </entity>
         </entity>



-- 
Regards,
Shalin Shekhar Mangar.