Solr学习二索引库的创建

上篇文章讲了基本的solr平台的搭建。

这里接着讲解solr索引库的创建。

1、在webapps中solr中solrhome目录下新建一个文件夹名字叫做myindex(名字不固定,可以随便取,但是这个名字在后面的配置中会有所关联)。

2、然后在myindex文件下新建一个名字叫做conf的文件夹(这个文件名字最后不要改)

3、然后把官网下下来的solr项目中solr-6.2.0\server\solr\configsets\data_driven_schema_configs\conf下的所有东西复制到conf中去。(注意不要复制错)

4、最后把solr-6.2.0\example\example-DIH\solr\db\conf下的admin-extra.html,admin-extra.menu-bottom.html ,admin-extra.menu-top.html三个文件也复制到conf中去。

如下图:


5、然后将solrconfig.xml文件中的以下部分注释掉,防止启动日志报警告。


6、最后在conf文件下的managed-schema配置field信息:

<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="title" type="string" indexed="true" stored="true" />
<field name="synopsis" type="string" indexed="true" stored="true"  />
<field name="updateTime" type="date" indexed="true" stored="true" />
	
<field name="_version_" type="long" indexed="true" stored="false"/>
<field name="_root_" type="string" indexed="true" stored="false" docValues="false" />
<field name="_text_" type="text_general" indexed="true" stored="false" multiValued="true"/>

 其中id,title,synopsis,updateTime是数据库中的字段。配置文件详解

下面三个field是Solr系统本身的不能删除,否则会运行错误。

7、启动Tomcat,打开http://localhost:8080/solr/index.html地址,选Core Admin然后点Add Core 输入内容如下图:

点确定即可。如下即添加成功。


成功后myindex索引库的文件结构和内容变化如下:



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值