时间:2021-07-01 10:21:17 帮助过:19人阅读
然后再本目录下的data-config.xml进行如下编辑(没有则创建):
<?xml version="1.0" encoding="UTF-8" ?> <dataConfig> <!-- 数据库信息 --> <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/college_service" user="root" password="mysql"/> <document> <!-- document实体 --> <entity name="news" query="SELECT * FROM news"> <!-- 数据库字段映射solr字段 --> <field column="news_id" name="id"/> <field column="news_authorid" name="newsAuthorid"/> <field column="news_title" name="newsTitle"/> <field column="news_cover" name="newsCover"/> <field column="news_time" name="newsTime"/> <field column="news_browse" name="newsBrowse"/> <field column="news_schoolid" name="newsSchoolid"/> <field column="news_categoryid" name="newsCategoryid"/> <field column="news_abstract" name="newsAbstract"/> <field column="news_content" name="newsContent"/> </entity> </document> </dataConfig>
然后在当前路径的managed-schema文件中加入相应的类型映射
<!--自定义的域--> <field name="newsAuthorid" type="string" indexed="true" stored="true"/> <field name="newsTitle" type="string" indexed="true" stored="true" /> <field name="newsCover" type="string" indexed="false" stored="true" /> <field name="newsTime" type="pdate" indexed="false" stored="true" /> <field name="newsBrowse" type="pint" indexed="false" stored="true" /> <field name="newsSchoolid" type="string" indexed="false" stored="true"/> <field name="newsCategoryid" type="string" indexed="false" stored="true" /> <field name="newsAbstract" type="text_ik" indexed="true" stored="true" /> <field name="newsContent" type="text_general" indexed="false" stored="true" />
登陆http://localhost:8983/solr/,进入以下模块,执行excute就导入数据了,没反应过来可以进行refresh status
solr8.0 从数据库导入数据(三)
标签:pre oca 数据库 http 类型 drive bst 一个 conf