当前位置:网站首页>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
边栏推荐
- R语言ggplot2可视化:使用ggplot2可视化散点图、使用labs参数自定义X轴的轴标签文本(customize X axis labels)
- TiCDC 6.0原理之Sorter演进
- LeetCode_69(x 的平方根 )
- Financial one account Hong Kong listed: market value of 6.3 billion HK $Ye wangchun said to be Keeping true and true, long - term work
- Zhizhen new energy rushes to the scientific innovation board: the annual revenue is 220million, and SAIC venture capital is the shareholder
- R language dplyr package select function, group_ By function, mutate function and cumsum function calculate the cumulative value of the specified numerical variable in the dataframe grouping data and
- 矩阵链乘 - 动态规划实例
- matlab学习2022.7.4
- Blue Bridge Cup study 2022.7.5 (morning)
- Laravel - view (new and output views)
猜你喜欢

魅族新任董事長沈子瑜:創始人黃章先生將作為魅族科技產品戰略顧問

How to deeply understand the design idea of "finite state machine"?

神经网络物联网未来发展趋势怎么样

Lepton 无损压缩原理及性能分析

Why do I support bat to dismantle "AI research institute"

Detailed explanation of IP address and preparation of DOS basic commands and batch processing

国富氢能冲刺科创板:拟募资20亿 应收账款3.6亿超营收

Introduction, installation, introduction and detailed introduction to postman!

昆仑太科冲刺科创板:年营收1.3亿拟募资5亿 电科太极持股40%

金融壹賬通香港上市:市值63億港元 葉望春稱守正篤實,久久為功
随机推荐
01 、Solr7.3.1 在Win10平台下使用jetty的部署及配置
Enjoy what you want. Zhichuang future
R语言dplyr包select函数、group_by函数、mutate函数、cumsum函数计算dataframe分组数据中指定数值变量的累加值、并生成累加数据列
如何将 DevSecOps 引入企业?
Hongmeng fourth training
[machine learning notes] how to solve over fitting and under fitting
2022 driller (drilling) examination question bank and simulation examination
昆仑太科冲刺科创板:年营收1.3亿拟募资5亿 电科太极持股40%
R language uses boxplot function in native package (basic import package, graphics) to visualize box plot
Shen Ziyu, nouveau Président de Meizu: M. Huang Zhang, fondateur de Meizu, agira comme conseiller stratégique pour les produits scientifiques et technologiques de Meizu
故障分析 | MySQL 耗尽主机内存一例分析
Zhizhen new energy rushes to the scientific innovation board: the annual revenue is 220million, and SAIC venture capital is the shareholder
Matlab learning 2022.7.4
Redis如何实现多可用区?
[js] basic syntax - for loop
Implementation process of WSDL and soap calls under PHP5
神经网络物联网未来发展趋势怎么样
PHP5下WSDL,SOAP调用实现过程
R language ggplot2 visualization: visual line graph, using legend in theme function The position parameter defines the position of the legend
2022 construction welder (special type of construction work) special operation certificate examination question bank and online simulation examination