我在数据导入配置文件的实体标签中尝试了以下 SQL:
<entity name="Page" dataSource="a1" query="SELECT &apos;26484-&apos;&amp;`book`.id&amp;&apos;-&apos;&amp;`book`.page&amp;&apos;-&apos;&amp;`book`.part AS PageID, `book`.id AS pid, `book`.nass AS Content, `book`.part AS Part, `book`.page AS PageNum FROM `book` ORDER BY `book`.id, `book`.page">
Sql 查询包含的字符应在 xml 中转义,' and &
. 但是,我在日志中收到以下错误:
DocBuilder Exception while processing: Page document : SolrInputDocument(fields: []):org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT '26484-'&`book`.id&'-'&`book`.page&'-'&`book`.part AS PageID, `book`.id AS pid, `book`.nass AS Content, `book`.part AS Part, `book`.page AS PageNum FROM `book` ORDER BY `book`.id, `book`.page Processing Document # 1
和
DataImporter Full Import failed:java.lang.RuntimeException: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT '26484-'&`book`.id&'-'&`book`.page&'-'&`book`.part AS PageID, `book`.id AS pid, `book`.nass AS Content, `book`.part AS Part, `book`.page AS PageNum FROM `book` ORDER BY `book`.id, `book`.page Processing Document # 1
我使用ucanaccess jdbc 驱动程序。
当我尝试从 SQL 查询中删除连接时,删除转义字符时,我没有收到此错误,但我收到了有关重复唯一键的 solrWriter 警告。我理解这个警告。但是,我怎样才能编写使用上面显示的 Sql 查询?