当前位置:网站首页>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
边栏推荐
- What are the advantages and characteristics of SAS interface
- Lepton 无损压缩原理及性能分析
- openGauss数据库源码解析系列文章—— 密态等值查询技术详解(下)
- The IPO of Ruineng industry was terminated: the annual revenue was 447million and it was planned to raise 376million
- 04_solr7.3之solrJ7.3的使用
- VC开发非MFC程序内存泄漏跟踪代码
- 为什么我认识的机械工程师都抱怨工资低?
- 循环不变式
- 神经网络物联网未来现状和趋势及看法
- The simplest way to open more functions without certificates
猜你喜欢
Why do mechanical engineers I know complain about low wages?
常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...
Sqllab 1-6 exercise
循环不变式
Shenziyu, the new chairman of Meizu: Mr. Huang Zhang, the founder, will serve as the strategic adviser of Meizu's scientific and technological products
Zhizhen new energy rushes to the scientific innovation board: the annual revenue is 220million, and SAIC venture capital is the shareholder
Mingfeng medical sprint technology innovation board: annual revenue of 350million yuan, proposed to raise 624million yuan
神经网络物联网未来发展趋势怎么样
How to introduce devsecops into enterprises?
国富氢能冲刺科创板:拟募资20亿 应收账款3.6亿超营收
随机推荐
国富氢能冲刺科创板:拟募资20亿 应收账款3.6亿超营收
Requset + BS4 crawling shell listings
登录界面代码
Blue Bridge Cup study 2022.7.5 (morning)
How to call the function mode of one hand and one machine
Tidb DM alarm DM_ sync_ process_ exists_ with_ Error troubleshooting
最简单不用证书也可以多开功能的方式
-Web direction attack and defense world
2022 driller (drilling) examination question bank and simulation examination
Discussion on memset assignment
不相交集
R语言ggplot2可视化:gganimate包基于transition_time函数创建动态散点图动画(gif)、使用shadow_mark函数为动画添加静态散点图作为动画背景
R language ggplot2 visual density map: Visual density map by group and custom configuration geom_ The alpha parameter in the density function sets the image transparency (to prevent multiple density c
Tdengine biweekly selection of community issues | phase III
物联网应用技术专业是属于什么类
一网打尽异步神器CompletableFuture
Make the seckill Carnival more leisurely: the database behind the promotion (Part 2)
UE source code reading [1]--- starting with problems delayed rendering in UE
常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...
Xampp configuring multiple items