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服务,进行界面化操作,跑数据了