On Fri, Oct 16, 2009 at 12:46 AM, William Pierce <evalsi...@hotmail.com>wrote:

> Thanks for your help.  Here is my DIH config file....I'd appreciate any
> help/pointers you may give me.  No matter what I do the documents are not
> getting deleted from the index.  My db has rows whose 'IndexingStatus' field
> has values of either 1 (which means add it to solr), or 4 (which means
> delete the document with the primary key from SOLR index).  I have two
> transformers running.  Not sure what I am doing wrong.
>
> <dataConfig>
>  <script><![CDATA[
>               function DeleteRow(row)    {
>                   var jis = row.get('IndexingStatus');
>                   var jid = row.get('Id');
>                   if ( jis == 4 ) {
>                        row.put('$deleteDocById', jid);
>                    }
>                   return row;
>               }
>       ]]></script>
>
>  <dataSource type="JdbcDataSource"
>             driver="com.mysql.jdbc.Driver"
>             url="jdbc:mysql://localhost/db"
>             user="******"
>             password="*******"/>
>  <document>
>   <entity name="post" transformer="script:DeleteRow, RegexTransformer"
>           query=" select  Id, a, b, c, IndexingStatus from  prod_table
> where (IndexingStatus = 1 or IndexingStatus = 4) ">
>        <field column="ptype" splitBy="," sourceColName="a" />
>        <field column="wauth" splitBy=","  sourceColName="b" />
>        <field column="miles" splitBy=","  sourceColName="c" />
>   </entity>
>  </document>
> </dataConfig>
>
>
One thing I'd try is to use '4' for comparison rather than the number 4 (the
type would depend on the sql type). Also, for javascript transformers to
work, you must use JDK 6 which has javascript support. Rest looks fine to
me.

-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to