我是 solr 的新手。我已经成功索引了 oracle 10g xe 数据库。我试图在相同的地方执行增量导入。增量查询需要将表的last_modified
列与${dih.last_index_time}
. 但是在我的应用程序中,我没有这样的专栏。另外,我无法添加此列。因此,我使用 ' scn_to_timestamp(ora_rowscn)
' 来给出所需时间戳的值。此查询以以下格式返回时间戳类型的值,24-JUL-13 12.42.32.000000000 PM
格式dih.last_index_time
为2013-07-24 12:18:03
. 所以,我改变了dih.last_index_time
as的格式to_timestamp('${dih.last_index_time}', 'YYYY/MM/DD HH:MI:SS').
我的数据配置看起来像这样 -
<dataConfig>
<dataSource type="JdbcDataSource" driver="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@XXX.XXX.XX.XX:XXXX:xe" user="XXXXXXXX" password="XXXXXXX" />
<document name="product_info">
<entity name="PRODUCT" pk="PID" query="SELECT * FROM PRODUCT" deltaImportQuery="SELECT * FROM PRODUCT WHERE PID=${dih.delta.id}" deltaQuery="SELECT PID FROM PRODUCT WHERE scn_to_timestamp(ora_rowscn) > to_timestamp('${dih.last_index_time}', 'YYYY/MM/DD HH:MI:SS')">
<field column="PID" name="id" />
<field column="PNAME" name="itemName" />
<field column="INITQTY" name="itemQuantity" />
<field column="REMQTY" name="remQuantity" />
<field column="PRICE" name="itemPrice" />
<field column="SPECIFICATION" name="specifications" />
<entity name="SUB_CATEGORY" query="SELECT * FROM SUB_CATEGORY WHERE SCID=${PRODUCT.SCID}">
<field column="SUBCATNAME" name="brand" />
<entity name="CATEGORY" query="SELECT CNAME FROM CATEGORY WHERE CID=${SUB_CATEGORY.CID}">
<field column="CNAME" name="itemCategory" />
</entity>
</entity>
</entity>
</document>
</dataConfig>
但是,这不起作用,我收到以下错误 -
Unable to execute query: SELECT * FROM PRODUCT WHERE PID= Processing Document # 1
Caused by: java.sql.SQLException: ORA-00936: missing expression
请帮帮我!!!