当前位置:网站首页>03_ Dataimport of Solr
03_ Dataimport of Solr
2022-07-05 14:12:00 【Full stack programmer webmaster】
solr The main core of is data , So how to put the data in the database we need to pass solr The analyzed data is imported into solr What about China? ? Next, we will learn how to configure files , Get data from the database , And import solr.
What we use here is mysql test .
1、 First in mysql Build a library :solr
A common table , Name it products, The table structure is as follows :
2、 Insert some test data :
After getting ready , Next, let's start solr The related configuration of the linked database :
1 Want to connect to the database through the configuration file , There must be a database driver , What I use here is Mysql.
Besides database driver , It also needs to be solr Bring your own two jar file , these two items. jar File is mainly used to import database data solr Server's , All in this directory :
A total of three. jar package , All copied and pasted to solr-7.3.1\server\solr-webapp\webapp\WEB-INF\lib
Get into solr-7.3.1\server\solr\test_Core\conf find solrconfig.xml file , open ,
Add the following configuration :
<!-- Database configuration -->
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
After the save , In the same category , establish data-config.xml file , This file is mainly about configuration database and configuration SQL Of the statement :
Open to add the following configuration :
To configure managed-schema Mapping relationship between database column and name in .
Copy the following code to managed-schema in :
goods document Of field Include :pid、pname、sort_id、sort_name、sale_price、pinfo、pic
First define Fieldtype:
solr Provided by itself fieldtype The type is enough. There is no need to define new .
pid: goods id Primary key
Use solr Provided by itself :
<field name="id"type="string" indexed="true" stored="true"required="true" multiValued="false" />
pname: Name of commodity
<field name="product_name"type="text_ik" indexed="true" stored="true"/>
sort_id: Classification of goods
<field name="product_sort_id"type="string" indexed="true" stored="true"/>
sort_name: Category name
<fieldname="product_sort_name" type="text_ik"indexed="true" stored="true"/>
sale_price: commodity price
<fieldname="product_sale_price" type="pfloat" indexed="true"stored="true"/>
desc: Commodity Description
<fieldname="product_desc" type="text_ik"indexed="true" stored="false"/>
pic: Commodity images
<field name="product_pic"type="string" indexed="false" stored="true"/>
thus , Relevant configurations have been processed ! Now start importing data :
Go to solr-7.3.1/bin Under boot solr:
Type in the browser localhost:8983/solr After entering , Find one's own core Then import the data according to the following figure :
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/111281.html Link to the original text :https://javaforall.cn
边栏推荐
- Getting started with rce
- 非技术部门,如何参与 DevOps?
- What is the future development trend of neural network Internet of things
- R語言ggplot2可視化:可視化折線圖、使用theme函數中的legend.position參數自定義圖例的比特置
- Make the seckill Carnival more leisurely: the database behind the promotion (Part 2)
- 蓝桥杯学习2022.7.5(上午)
- Laravel - model (new model and use model)
- 基于 TiDB 场景式技术架构过程 - 理论篇
- WebRTC的学习(二)
- 金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
猜你喜欢
金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
让秒杀狂欢更从容:大促背后的数据库(下篇)
OSI and tcp/ip protocol cluster
Guofu hydrogen energy rushes to the scientific and Technological Innovation Board: it plans to raise 2billion yuan, and 360million yuan of accounts receivable exceed the revenue
昆仑太科冲刺科创板:年营收1.3亿拟募资5亿 电科太极持股40%
基于 TiDB 场景式技术架构过程 - 理论篇
The IPO of Ruineng industry was terminated: the annual revenue was 447million and it was planned to raise 376million
Tidb DM alarm DM_ sync_ process_ exists_ with_ Error troubleshooting
清大科越冲刺科创板:年营收2亿 拟募资7.5亿
瑞能实业IPO被终止:年营收4.47亿 曾拟募资3.76亿
随机推荐
展现强大。这样手机就不会难前进
SSH免密码登录详解
金融壹账通香港上市:市值63亿港元 叶望春称守正笃实,久久为功
Sorter evolution of ticdc 6.0 principle
R语言ggplot2可视化:可视化折线图、使用theme函数中的legend.position参数自定义图例的位置
Lepton 无损压缩原理及性能分析
upload (1-6)
Blue Bridge Cup study 2022.7.5 (morning)
Show strength. In this way, the mobile phone will not be difficult to move forward
2022 driller (drilling) examination question bank and simulation examination
04_solr7.3之solrJ7.3的使用
Laravel - view (new and output views)
poi设置列的数据格式(有效)
循环不变式
VC development of non MFC program memory leak tracking code
Why do mechanical engineers I know complain about low wages?
Login interface code
PHP5下WSDL,SOAP调用实现过程
广发期货排名多少?网上办理广发期货开户安全可靠吗?
C - Divisors of the Divisors of An Integer Gym - 102040C