On Sat, Jul 31, 2010 at 3:40 AM, Harry Smith <harrysmith...@gmail.com>wrote:

> Just starting with DataImportHandler and had a few simple questions.
>
> Is there a location for more in depth documentation other than
> http://wiki.apache.org/solr/DataImportHandler?
>
>
Umm, no, but let us know what is not covered well and it can be added.


> Specifically I was looking for a detailed document outlining
> data-config.xml, the fields and attributes and how they are used.
>
> * Is there a way to dynamically generate field elements from the
> supplied sql statement?
>
> Example: Suppose one has a table of 100 fields. Entering this manually
> for each field is not very efficient.
>
> ie, if table has only 3 columns this is easy enough...
>
> <entity name="item" query="select * from item">
>            <field column="ID" name="id" />
>            <field column="NAME" name="name" />
>            <field column="MANU" name="manu" />
> <entity>
>
> What are the options if ITEM table has dozens or hundreds?
>
>
Yes! You do not need to specify the column names as long as your Solr schema
defines the same field names.

See http://wiki.apache.org/solr/DataImportHandler#A_shorter_data-config


>
> * Is there a way to apply insert logic based on the value of the incoming
> field?
>
> My specific use case would be, if the incoming value is null, do not
> add to Solr.
>
>
DIH Transformers are the way. However, in this particular case, you do not
need to worry because nulls are not inserted into the index.

-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to