当前位置:网站首页>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
边栏推荐
- [machine learning notes] how to solve over fitting and under fitting
- TiFlash 源码解读(四) | TiFlash DDL 模块设计及实现分析
- Comparison of several distributed databases
- R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses the coef function to obtain the log odds ratio corresponding to eac
- 鏈錶(簡單)
- Anchor navigation demo
- 基于伯努利原理的速度监测芯片可用于天然气管道泄露检测
- Deep copy is hard
- After the microservice project is deployed, static resources and files uploaded to upload cannot be accessed. Solution
- Geom of R language using ggplot2 package_ Histogram function visual histogram (histogram plot)
猜你喜欢

Xampp configuring multiple items

What category does the Internet of things application technology major belong to

明峰医疗冲刺科创板:年营收3.5亿元 拟募资6.24亿

OSI and tcp/ip protocol cluster

魅族新任董事长沈子瑜:创始人黄章先生将作为魅族科技产品战略顾问

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

软件测试人在深圳有哪些值得去的互联网公司【软件测试人员专供版】

常见问题之PHP——Fatal error: Allowed memory size of 314572800 bytes exhausted...
![Which Internet companies are worth going to in Shenzhen for software testers [Special Edition for software testers]](/img/c2/a5f5fe17a6bd1f6f9df828ddd224d6.png)
Which Internet companies are worth going to in Shenzhen for software testers [Special Edition for software testers]

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
随机推荐
R language uses the polR function of mass package to build an ordered multi classification logistic regression model, and uses the coef function to obtain the log odds ratio corresponding to each vari
微服务项目部署后,无法访问静态资源,无法访问到上传到upload中的文件,解决办法
Zhizhen new energy rushes to the scientific innovation board: the annual revenue is 220million, and SAIC venture capital is the shareholder
Tdengine biweekly selection of community issues | phase III
R language uses the multinom function of NNET package to build an unordered multi classification logistic regression model, and uses the coef function to obtain the log odds ratio corresponding to eac
如何深入理解“有限状态机”的设计思想?
03_Solr之dataimport
神经网络物联网未来发展趋势怎么样
享你所想。智创未来
PHP5下WSDL,SOAP调用实现过程
蓝桥杯学习2022.7.5(上午)
tidb-dm报警DM_sync_process_exists_with_error排查
故障分析 | MySQL 耗尽主机内存一例分析
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
展现强大。这样手机就不会难前进
Comparison of several distributed databases
广发期货排名多少?网上办理广发期货开户安全可靠吗?
Simple process of penetration test
R语言ggplot2可视化条形图:通过双色渐变配色颜色主题可视化条形图、为每个条形添加标签文本(geom_text函数)
After the microservice project is deployed, static resources and files uploaded to upload cannot be accessed. Solution