• Solr7.7安装,链接数据库并导入数据,中级导入数据


    本地新建data-config.xml,然后拖拽到Linux上新建的db文件夹下面,新建目录如下
    mkdir /soft/solr-7.7.0/server/solr/core0/conf/db/

    data-config.xml文件内容如下:

    <dataConfig>
    <dataSource driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://192.168.0.11;DatabaseName=test" user="sa" password="123456"/>
    <document name="Info">

    <entity name="Projects" pk="OriginalID" transformer="ClobTransformer"
     
    query="SELECT  dbo.ShowLabelByInfoID(OriginalID) label,  OriginalID,'拟在建项目' as orderColumn,Project_Title,dbo.ShowLabelName(Area) as Area,dbo.ShowLabelName2(Industry) as Industry,dbo.ShowLabelName2(detailIndustry) as detailIndustry,dbo.ShowLabelName3(detailIndustry) as AllIndustry,Phase,dbo.ShowLabelName3(Phase) as AllPhase,PhaseType,Project_Pfund,Project_Kind,Project_Ukind,Project_Equip,Project_Equips,Project_Owner,Project_Designer,(dbo.fun_joinInfo(OriginalID)+Project_Intro)  as Project_Intro ,AddDate,'拟在建项目' as columns,title as title3,releasetime FROM Info_Project ORDER BY releasetime DESC"
    deltaImportQuery="SELECT dbo.ShowLabelByInfoID(OriginalID) label,   OriginalID,'拟在建项目' as orderColumn,Project_Title,dbo.ShowLabelName(Area) as Area,dbo.ShowLabelName2(Industry) as Industry,dbo.ShowLabelName2(detailIndustry) as detailIndustry,dbo.ShowLabelName3(detailIndustry) as AllIndustry,Phase,dbo.ShowLabelName3(Phase) as AllPhase,PhaseType,Project_Pfund,Project_Kind,Project_Ukind,Project_Equip,Project_Equips,Project_Owner,Project_Designer,(dbo.fun_joinInfo(OriginalID)+Project_Intro)  as Project_Intro ,AddDate,'拟在建项目' as columns,title as title3,releasetime FROM Info_Project where OriginalID ='${dataimporter.delta.OriginalID}'"
    deltaQuery="SELECT OriginalID  FROM Info_Project where releasetime > '${dataimporter.last_index_time}'" >
        <field column="OriginalID"            name="id"            />
        <field column="Project_Title"        name="title"        />
        <field column="Project_Title"        name="title2"        />
        <field column="title3"        name="title3"        />
        <field column="area"        name="area"          />
        <field column="industry"    name="industry"    />
        <field column="detailIndustry"    name="detailIndustry_s"    />
        <field column="AllIndustry"    name="alldetailIndustry_s"    />
        <field column="Project_Intro"        name="body"        />
        <field column="adddate"        name="adddate"        />
        <field column="releasetime"        name="releasetime"        />
        <field column="ColumnID"    name="sorts"    />
        <field column="OriginalID"    name="url"    />
        <field column="columns"    name="columns" />
        <field column="orderColumn"    name="orderColumn" />
        <field column="phase"    name="phase" />
        <field column="AllPhase"    name="phase_s" />
        <field column="PhaseType"    name="phasetype" />
        <field column="Project_Pfund"    name="pfund" />
        <field column="Project_Kind"    name="kind" />
        <field column="Project_Ukind"    name="ukind" />
        <field column="Project_Equip"    name="equip" />
        <field column="Project_Equips"    name="equips" />
        <field column="Project_Owner"    name="owner" />
        <field column="Project_Designer"    name="designer" />
        <field column="label"    name="label" />
    </entity>
    </document>
    </dataConfig>

    文件配置介绍:

    编辑文件 managed-schema ,在/soft/solr-7.7.0/server/solr/core0/conf/目录下,同样还是下载到本地编辑,配置里面的字段类型,包括 int、string、小数、时间、中文拆分词、英文拆分词

      <field name="id" type="string" indexed="true" stored="true" required="true" />
      <field name="title" type="text_ik" default="" indexed="true" stored="true" multiValued="false" />
      <field name="title3" type="text_ik" indexed="true" stored="true" multiValued="false" />
      <field name="title2" type="string" default="" indexed="true" stored="true"  />
      <field name="area" type="string" default="" indexed="true" stored="true" />
      <field name="industry" type="string" default="" indexed="true" stored="true" />
      <field name="industrys" type="string" default="" indexed="true" stored="true" />
      <field name="body" type="text_ik" indexed="true" stored="true" multiValued="false" />
      <field name="adddate" type="pdate" indexed="true" stored="true" multiValued="false"/>
      <field name="releasetime" type="pdate" indexed="true" stored="true" multiValued="false"/>
      <field name="columns" type="text_ik" indexed="true" stored="true"/>
      <field name="sorts" type="string" default="" indexed="true" stored="true"/>
      <field name="url" type="string" default="" indexed="true" stored="true" required="true" />
      <field name="orderColumn" type="text_ik" indexed="true" stored="true"/>
      <field name="phase" type="string" default="" indexed="true" stored="true"/>
      <field name="phasetype" type="string" default="" indexed="true" stored="true"/>
      <field name="pfund" type="pdouble" default="0.0" indexed="true" stored="true"/>
      <field name="price"  type="pfloat" default="0.0" indexed="true" stored="true"/>
      <field name="kind" type="string" default="" indexed="true" stored="true" />
      <field name="ukind" type="string" default="" indexed="true" stored="true" />
      <field name="equip" type="string" default="" indexed="true" stored="true" />
      <field name="equips" type="string" default="" indexed="true" stored="true" />
      <field name="owner" type="string" default="" indexed="true" stored="true" />
      <field name="designer" type="string" default="" indexed="true" stored="true" />
      <field name="flag" type="string" default="" indexed="true" stored="true" />
      <field name="builder" type="text_ik" indexed="true" stored="true" />
      <field name="label" type="text_en_splitting" indexed="true" stored="true" /> 

    字段类型说明:

     如果不需要中文分词的,上述两个文件在本地配置好后,上传到服务器上,重启solr服务,进行界面化操作,跑数据了

  • 相关阅读:
    PKG_CONFIG_PATH 、LD_LIBRARY_PATH、PATH三个的作用
    klocwork报错:Error occurred during build: C/C+ defects detection stage failed. Program exited with 139
    修改默认内核启动以及删除Linux多余的内核
    【笔记】ubuntu内核升级到4.19后,docker服务无法启动
    TypeError: unhashable type: 'collections.OrderedDict'
    jquery 如何给新生成的元素绑定 hover事件?
    css中判断IE版本的语句
    (转)JS获取当前对象大小以及屏幕分辨率等
    (转)ie浏览器判断
    (转)javascript中的this
  • 原文地址:https://www.cnblogs.com/caleyun/p/10456181.html
Copyright © 2020-2023  润新知