(我已经在下面的XML中显示了它)
大家好我想用solr索引我的MySQL数据库表.我已经安装了必要的java组件/适配器等.我的数据库名为’test_db’,其中的表名为’table_tb’.该表包含2列(字段)
-Field 1称为“ID”,是一个自动增量的主键整数
-Field 2被称为’COLA’并且是文本
该表有两行(记录)ID = 1和ID = 2,其中一些文本对应于第二列.我已经设置了以下conf文件(它们位于正确的目录中):
数据-config.xml中
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/test_db"
user="username"
password="db_pwd"/>
solrconfig.xml中
data-config.xml
schema.xml中
ID
“[URL]:8983 / solr / dataimport?command = full-import”在我的浏览器中,我得到以下输出:
(1)浏览器输出(xml)
−
0
1
−
−
data-config.xml
full-import
idle
−
1
2
0
2010-08-03 16:15:51
−
Indexing completed. Added/Updated: 0 documents. Deleted 0 documents.
2010-08-03 16:15:51
2010-08-03 16:15:51
0
2
0:0:0.32
−
This response format is experimental. It is likely to change in the future.
建议读取2条记录但未编入索引
服务器端输出
WARNING: Error creating document : SolrInputDocument[{ID=ID(1.0)={1}}]
org.apache.solr.common.SolrException: Document [null] missing required field: id
WARNING: Error creating document : SolrInputDocument[{ID=ID(1.0)={2}}]
org.apache.solr.common.SolrException: Document [null] missing required field: id
有谁知道我做错了什么?
在此先感谢任何帮助!
解决方法:
字段“id”出现在文档的其他位置.我评论了这一点并且有效.
标签:java,mysql,search,solr,lucene
来源: https://codeday.me/bug/20190621/1257779.html