$deleteDocByQuery is not working for me

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

$deleteDocByQuery is not working for me

Paresh
Hi,

I am trying to write an entity to delete documents for the records marked as
deleted in my rdbms database using db-data-config.xml file with following
entry in an entity -

query="SELECT CONCAT( 'ColName:', dbCol ) AS '$deleteDocByQuery' FROM TABLE1
t1 WHERE t1.state = 1 AND t1.lmd > TO_DATE
('${dih.last_index_time}','YYYY-MM-DD HH24:MI:SS')"

Through SOLR-Admin UI I am selecting "delta-import", entity-name and giving
proper jdbc string in custom-parameters.

I have marked the ColName represented in Solr as deleted in RDBMS Table1
using state column value of 1.

ColName is Solr column-name for the collection. dbCol - database column name
in Table1

I am trying to use $deleteDocByQuery clause to remove documents.

Any help is appreciated.

Regards,
Paresh



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Reply | Threaded
Open this post in threaded view
|

Re: $deleteDocByQuery is not working for me

Paresh
This post was updated on .
Hi,

I am able to get it done using following way -

Approach 1:
---------------

<entity name="delete_from_index" pk="ID" transformer="TemplateTransformer"
        query="SELECT dbColumnName FROM dbTableName where pstate = 1 AND
                  plast_modified_date &gt; TO_DATE
('${dih.last_index_time}','YYYY-MM-DD HH24:MI:SS')" >
            <field column="$deleteDocByQuery"
                template="solrFieldName:${delete_from_index.dbColumnName}"/>
            <field column="ID" name="id"/>
            <field column="DBCOLUMNNAME" name="solrFieldName"/>
</entity>


Approach 2:
--------------
 <entity name="product_scope_delete" pk="ID"
      query="SELECT CONCAT( 'solrFieldName:', dbColumnName ) AS
           &quot;$deleteDocByQuery&quot; FROM dbTableName t1 WHERE t1.pstate = 1 AND
            t1.plast_modified_date &gt; TO_DATE ('${dih.last_index_time}','YYYY-MM-DD HH24:MI:SS')">
        <field column="ID" name="id"/>
        <field column="DBCOLUMNNAME" name="solrFieldName"/>
  </entity>

Thanks,
Paresh



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html