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>
Thanks,
- Bill
--------------------------------------------------
From: "Shalin Shekhar Mangar" <shalinman...@gmail.com>
Sent: Thursday, October 15, 2009 11:03 AM
To: <solr-user@lucene.apache.org>
Subject: Re: Using DIH's special commands....Help needed
On Thu, Oct 15, 2009 at 10:42 PM, William Pierce
<evalsi...@hotmail.com>wrote:
Thanks, Shalin. I am sorry if I phrased it incorrectly. Yes, I want
to
know how to delete documents in the solr index using the
$deleteDocByQuery
special command. I looked in the wiki doc and could not find out how to
do
this....
Sorry, I misunderstood your intent. These special flag variables can be
emitted by Transformers. So what you can do is write a Transformer which
checks if the current row contains "PendingDelete" in the column and add a
key/value pair to the Map. The key should be "$deleteDocByQuery" and value
should be the Solr query to be used for deletion. You can write the
transformer in Java as well as Javascript.
--
Regards,
Shalin Shekhar Mangar.