<dataConfig> <!-- <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_studio" user="yxj" password="yxj@2015" /> --> <dataSource name ="db_yxj_content" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_content" user="xxx" password="xxx" /> <dataSource name ="db_yxj_user" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_user" user="xxx" password="xxx" /> <document name = "insert_test"> <entity name="video" transformer="DateFormatTransformer" query="SELECT CONCAT(v.vdoid,'video') as id, v.vdoid AS vdoid, v.catid AS catid, v.catids AS catids, v.proid AS proid, v.title AS title, ifnull(v.content, '') AS content, v.num AS num, v.vdo_type AS vdoType, v.play_url AS playUrl, LEFT ( FROM_UNIXTIME(v.publish_time), 10 ) AS publishTime, v. STATUS AS STATUS, v.keywords AS keywords, v.coverpic_url AS coverpicUrl, v.end_time AS endTime, v.start_time AS startTime, FROM_UNIXTIME( v.update_time, '%Y-%m-%d %H:%m:%s' ) AS updateTime, v.isTop AS isTop, parent_id AS parentId, p.proid AS proid, ifnull(p. NAME, '') AS proName, ifnull(p.org, '') AS proOrg, ifnull(p.title, '') AS proTitle, ifnull(p.department, '') AS proDepartment, ifnull(CONCAT(p. NAME, p.title, ' ', p.org), '') AS tempContent FROM db_yxj_content.t_video v LEFT JOIN db_yxj_user.t_professor p ON v.proid = p.proid WHERE v. STATUS = 0 AND ( ( v.vdo_type = 1 AND ( classify_flag = 2 OR length(v.play_url) > 0 ) ) OR v.vdo_type = 10 )"> <field column='publishTime' dateTimeFormat='yyyy-MM-dd' /> <field column='updateTime' dateTimeFormat='yyyy-MM-dd HH:mm:ss' /> </entity> </document> </dataConfig> |
<dataConfig> <!-- <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_studio" user="yxj" password="yxj@2015" /> --> <dataSource name ="db_yxj_content" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_content" user="xxx" password="xxx" /> <dataSource name ="db_yxj_user" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_user" user="xxx" password="xxx" /> <document name = "insert_test"> <entity name="video" transformer="DateFormatTransformer" query="SELECT CONCAT(v.vdoid,'video') as id, v.vdoid AS vdoid, v.catid AS catid, v.catids AS catids, v.proid AS proid, v.title AS title, ifnull(v.content, '') AS content, v.num AS num, v.vdo_type AS vdoType, v.play_url AS playUrl, LEFT ( FROM_UNIXTIME(v.publish_time), 10 ) AS publishTime, v. STATUS AS STATUS, v.keywords AS keywords, v.coverpic_url AS coverpicUrl, v.end_time AS endTime, v.start_time AS startTime, FROM_UNIXTIME( v.update_time, '%Y-%m-%d %H:%m:%s' ) AS updateTime, v.isTop AS isTop, parent_id AS parentId, p.proid AS proid, ifnull(p. NAME, '') AS proName, ifnull(p.org, '') AS proOrg, ifnull(p.title, '') AS proTitle, ifnull(p.department, '') AS proDepartment, ifnull(CONCAT(p. NAME, p.title, ' ', p.org), '') AS tempContent FROM db_yxj_content.t_video v LEFT JOIN db_yxj_user.t_professor p ON v.proid = p.proid WHERE v. STATUS = 0 AND ( ( v.vdo_type = 1 AND ( classify_flag = 2 OR length(v.play_url) > 0 ) ) OR v.vdo_type = 10 )" deltaImportQuery ="SELECT CONCAT(v.vdoid,'video') as id, v.vdoid AS vdoid, v.catid AS catid, v.catids AS catids, v.proid AS proid, v.title AS title, ifnull(v.content, '') AS content, v.num AS num, v.vdo_type AS vdoType, v.play_url AS playUrl, LEFT ( FROM_UNIXTIME(v.publish_time), 10 ) AS publishTime, v. STATUS AS STATUS, v.keywords AS keywords, v.coverpic_url AS coverpicUrl, v.end_time AS endTime, v.start_time AS startTime, FROM_UNIXTIME( v.update_time, '%Y-%m-%d %H:%m:%s' ) AS updateTime, v.isTop AS isTop, parent_id AS parentId, p.proid AS proid, ifnull(p. NAME, '') AS proName, ifnull(p.org, '') AS proOrg, ifnull(p.title, '') AS proTitle, ifnull(p.department, '') AS proDepartment, ifnull(CONCAT(p. NAME, p.title, ' ', p.org), '') AS tempContent FROM db_yxj_content.t_video v LEFT JOIN db_yxj_user.t_professor p ON v.proid = p.proid WHERE v.vdoid = '${dih.delta.id}'" deltaQuery ="SELECT v.vdoid AS id FROM db_yxj_content.t_video v LEFT JOIN db_yxj_user.t_professor p ON v.proid = p.proid WHERE v. STATUS = 0 AND ( ( v.vdo_type = 1 AND ( classify_flag = 2 OR length(v.play_url) > 0 ) ) OR v.vdo_type = 10 ) AND ( FROM_UNIXTIME( v.update_time, '%Y-%m-%d %H:%m:%s' ) > '${dataimporter.video.last_index_time}' OR FROM_UNIXTIME( v.publish_time, '%Y-%m-%d %H:%m:%s' ) > '${dataimporter.video.last_index_time}' ) "> <field column='publishTime' dateTimeFormat='yyyy-MM-dd' /> <field column='updateTime' dateTimeFormat='yyyy-MM-dd HH:mm:ss' /> </entity> </document> </dataConfig> |
<dataConfig> <!-- <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_studio" user="yxj" password="yxj@2015" /> --> <dataSource name ="db_yxj_content" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_content" user="xxx" password="xxx" /> <dataSource name ="db_yxj_user" type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://123.59.41.168:3306/db_yxj_user" user="xxx" password="xxx" /> <document name = "insert_test"> <entity name="video" transformer="DateFormatTransformer" query="SELECT CONCAT(v.vdoid,'video') as id, v.vdoid AS vdoid, v.catid AS catid, v.catids AS catids, v.proid AS proid, v.title AS title, ifnull(v.content, '') AS content, v.num AS num, v.vdo_type AS vdoType, v.play_url AS playUrl, LEFT ( FROM_UNIXTIME(v.publish_time), 10 ) AS publishTime, v. STATUS AS STATUS, v.keywords AS keywords, v.coverpic_url AS coverpicUrl, v.end_time AS endTime, v.start_time AS startTime, FROM_UNIXTIME( v.update_time, '%Y-%m-%d %H:%m:%s' ) AS updateTime, v.isTop AS isTop, parent_id AS parentId, p.proid AS proid, ifnull(p. NAME, '') AS proName, ifnull(p.org, '') AS proOrg, ifnull(p.title, '') AS proTitle, ifnull(p.department, '') AS proDepartment, ifnull(CONCAT(p. NAME, p.title, ' ', p.org), '') AS tempContent FROM db_yxj_content.t_video v LEFT JOIN db_yxj_user.t_professor p ON v.proid = p.proid WHERE v. STATUS = 0 AND ( ( v.vdo_type = 1 AND ( classify_flag = 2 OR length(v.play_url) > 0 ) ) OR v.vdo_type = 10 )"> <field column='publishTime' dateTimeFormat='yyyy-MM-dd' /> <field column='updateTime' dateTimeFormat='yyyy-MM-dd HH:mm:ss' /> </entity> <entity name="article" transformer="DateFormatTransformer" query="SELECT CONCAT(art.artid,'article') as id, art.artid as artid, art.art_date as artDate, art.num as num, art.title as artTitle, art.brief as brief, art.minpic_url as minpicUrl, art.content as artContent, art.update_time as artUpdateTime FROM db_yxj_content.t_article art WHERE art. STATUS = 0"> <field column='updateTime' dateTimeFormat='yyyy-MM-dd HH:mm:ss' /> </entity> </document> </dataConfig> |
<!-- t_video 普通字段不需要建立索引--> <field name="vdoid" type="plong" indexed="true" stored="true"/> <field name="catid" type="plong" indexed="false" stored="true"/> <field name="catids" type="string" indexed="false" stored="true"/> <field name="proid" type="plong" indexed="false" stored="true"/> <field name="title" type="string" indexed="false" stored="true"/> <field name="num" type="pint" indexed="false" stored="true"/> <field name="publishTime" type="pdate" indexed="false" stored="true"/> <field name="coverpicUrl" type="string" indexed="false" stored="true"/> <field name="endTime" type="plong" indexed="false" stored="true"/> <field name="updateTime" type="pdate" indexed="false" stored="true"/> <field name="content" type="text_general" indexed="false" stored="true"/> <field name="playUrl" type="string" indexed="false" stored="true"/> <field name="vdoType" type="pint" indexed="false" stored="true"/> <field name="startTime" type="plong" indexed="false" stored="true"/> <field name="parentId" type="string" indexed="false" stored="true"/> <field name="keywords" type="string" indexed="false" stored="true"/> <!-- guan lian --> <field name="tempContent" type="string" indexed="false" stored="true"/> <field name="proName" type="string" indexed="false" stored="true"/> <field name="proOrg" type="string" indexed="false" stored="true"/> <field name="proDepartment" type="string" indexed="false" stored="true"/> <field name="proTitle" type="string" indexed="false" stored="true"/> <!-- copyField就引出了solr的一個全文檢索的概念,如果我要實現一個搜索,而我要搜索的屬性有很多個那麼應該使用如下配置方法--> <copyField source="title" dest="text_video"/> <copyField source="proName" dest="text_video"/> <copyField source="proOrg" dest="text_video"/> <copyField source="content" dest="text_video"/> <!-- 搜索用建立索引 不需要返回--> <field name="text_video" type="text_ik" indexed="true" stored="false" multiValued="true" /> <!-- t_article 普通字段不需要建立索引--> <field name="artid" type="plong" indexed="true" stored="true" /> <field name="artDate" type="string" indexed="false" stored="true"/> <field name="artNum" type="pint" indexed="false" stored="true"/> <field name="artTitle" type="string" indexed="false" stored="true"/> <field name="brief" type="string" indexed="false" stored="true"/> <field name="minpicUrl" type="string" indexed="false" stored="true"/> <field name="artContent" type="text_general" indexed="false" stored="true"/> <field name="artUpdateTime" type="plong" indexed="false" stored="true"/> <!-- copyField就引出了solr的一個全文檢索的概念,如果我要實現一個搜索,而我要搜索的屬性有很多個那麼應該使用如下配置方法--> <copyField source="artTitle" dest="text_article"/> <copyField source="brief" dest="text_article"/> <copyField source="artContent" dest="text_article"/> <!-- 搜索用建立索引 不需要返回--> <field name="text_article" type="text_ik" indexed="true" stored="true" multiValued="true" /> |
################################################# # # # dataimport scheduler properties # # # ################################################# # to sync or not to sync # 1 - active; anything else - inactive syncEnabled=1 # which cores to schedule # in a multi-core environment you can decide which cores you want syncronized # leave empty or comment it out if using single-core deployment # 你的核心 名稱,多個用‘,’隔開 syncCores=testCore # solr server name or IP address # [defaults to localhost if empty] server=localhost # solr server port # [defaults to 80 if empty] # 你得solr 的啓動的端口號 port=8888 # application name/context # [defaults to current ServletContextListener's context (app) name] # webapp的名稱 webapp=solr # URL params [mandatory] # remainder of URL # 請求的參數 params=/dataimport?command=delta-import&clean=false&commit=true&optimize=false&wt=json&indent=on&verbose=false&debug=true # schedule interval # number of minutes between two runs # [defaults to 30 if empty] # 執行的頻率,分鐘 interval=1 |
<listener> <listener-class>org.apache.solr.handler.dataimport.scheduler.ApplicationListener</listener-class> </listener> |