solr5全量索引配置

1.在solrhome/rsm/conf/solrconfig.xml中进行如下配置

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
        <lst name="defaults">
            <str name="config">t_rsm.xml</str>
        </lst>
    </requestHandler>

加载配置新建的与数据库建立关系的配置

注:t_rsm.xml与solrconfig.xml在同一目录下

2.t_rsm.xml写入数据库连接地址,和要索引的字段

<dataConfig>
    <dataSource name="jdbc" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/rencai" user="root"
        password="root" />
    <document>
        <entity name="rsm_resume" pk="id"
            query="select resumeID as id,resumeName,job,experience,education,rsmstatus,salary,sex,location,district,subway,objvalue,subjvalue,selfvalue,skill,updatetime,leixing,place,updateUser,resumeTime,content2 from rsm_resume"
            deltaQuery="select resumeID as id,resumeName,job,experience,education,rsmstatus,salary,sex,location,district,subway,objvalue,subjvalue,selfvalue,skill,updateTime,leixing,place,updateUser,resumeTime,content2 from rsm_resume where updatetime > '${dataimporter.last_index_time}' "
            deltaImportQuery="select resumeID as id,resumeName,job,experience,education,rsmstatus,salary,sex,location,district,subway,objvalue,subjvalue,selfvalue,skill,updatetime,leixing,place,updateUser,resumeTime,content2 from rsm_resume where resumeID = '${dataimporter.delta.id}' ">


            <field column="resmeID" name="id" />
            <field column="resumeName" name="Resumename" />
            <field column="job" name="Job" />
            <field column="experience" name="Experience" />
            <field column="education" name="Education" />
            <field column="rsmstatus" name="Rsmstatus" />
            <field column="salary" name="Salary" />
            <field column="sex" name="Sex" />
            <field column="location" name="Location" />
            <field column="district" name="District" />
            <field column="subway" name="Subway" />
            <field column="objvalue" name="Objvalue" />
            <field column="subjvalue" name="Subjvalue" />
            <field column="selfvalue" name="Selfvalue" />
            <field column="skill" name="Skill" />
            <field column="updatetime" name="Updatetime" />
<field column="leixing" name="Leixing" />
<field column="place" name="Place" />
<field column="updateUser" name="UpdateUser" />
<field column="resumeTime" name="ResumeTime" />
<field column="content2" name="Content2" />
        </entity>


    </document>
</dataConfig>
3.在和solrconfig.xml同目录下的schema.xml中配置索引字段的数据类型

<field name="Updatetime" type="date" indexed="true" stored="true" />
    <field name="Resumename" type="text_general" indexed="true" stored="true" />
    <field name="Job" type="text_general" indexed="true" stored="true" />
    <field name="Salary" type="text_general" indexed="true" stored="true" />
    <field name="Experience" type="int" indexed="true" stored="true" />
    <field name="Education" type="text_general" indexed="true" stored="true" />
    <field name="Sex" type="text_general" indexed="true" stored="true" />
    <field name="Location" type="text_general" indexed="true" stored="true" />
    <field name="District" type="text_general" stored="true" />
    <field name="Subway" type="text_general" indexed="true" stored="true" />
    <field name="Objvalue" type="text_general" indexed="true" stored="true" />
    <field name="Subjvalue" type="text_general" indexed="true" stored="true" />
    <field name="Rsmstatus" type="text_general" indexed="true" stored="true" />
<field name="Leixing" type="int" indexed="true" stored="true" />
<field name="Place" type="text_general" indexed="true" stored="true" />
<field name="UpdateUser" type="text_general" indexed="true" stored="true" />
<field name="ResumeTime" type="date" indexed="true" stored="true" />
<field name="Content2" type="text_general" indexed="true" stored="true" />


    <field name="Selfvalue" type="text_general" indexed="true" stored="false" />
    <field name="Skill" type="text_general" indexed="true" stored="false" />


    <field name="Createtime" type="date" indexed="true" stored="false" />
    <field name="Software" type="text_general" indexed="true" stored="false" />
    <field name="Hardware" type="text_general" indexed="true" stored="false" />
    <field name="Tools" type="text_general" indexed="true" stored="false" />
    <field name="Duty" type="text_general" indexed="true" stored="false" />
    <field name="Projdetail" type="text_general" indexed="true" stored="false" />


    <field name="Valuespec" type="text_general" indexed="true" stored="false" />
    <field name="Experdetail" type="text_general" indexed="true" stored="false" />

使用时发送url:http://localhost:8080/solr/new_core/dataimport?command=full-import&commit=true&clean=true


到此solr的全量更新配置就完成了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值