solrのDHI構成

2268 ワード


  1.add follow code in solrconfig.xml 
   
<requestHandler name="/dhi"class="org.apache.solr.handler.dataimport.DataImportHandler">
  <lst name="defaults">
    <str name="config">data-config.xml</str>
  </lst>
</requestHandler>

  
   2.new file data-config.xml at solr home dir
  
<dataConfig>
	<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbcurl" user="**" password = "**"/>
	<document>
		<entity name="item" query="select id,first_menu_title,second_menu_title,title,content from hike_issue_library">
			<field column="id" name="id" />
			<field column="first_menu_title" name="firstMenuTitle" />
			<field column="second_menu_title" name="secondMenuTitle" />
			<field column="title" name="title" />
			<field column="content" name="content" />
		</entity>
	</document>
</dataConfig>

 
  3.schema.xml  add depandence jar
  
  <lib dir="D:\work\solr-4.6.0\contrib\extraction\lib\" regex=".*\.jar" />
  <lib dir="D:\work\solr-4.6.0\dist\" regex="solr-cell-\d.*\.jar" />
  <lib dir="D:\work\solr-4.6.0\contrib\clustering\lib\" regex=".*\.jar" />
  <lib dir="D:\work\solr-4.6.0\dist\" regex="solr-clustering-\d.*\.jar" />
  <lib dir="D:\work\solr-4.6.0\contrib\langid\lib\" regex=".*\.jar" />
  <lib dir="D:\work\solr-4.6.0\dist\" regex="solr-langid-\d.*\.jar" />
  <lib dir="D:\work\solr-4.6.0\contrib\velocity\lib" regex=".*\.jar" />
  <lib dir="D:\work\solr-4.6.0\dist\" regex="solr-velocity-\d.*\.jar" />
  <lib dir="D:\work\solr-4.6.0\dist\" regex="solr-dataimporthandler-\d.*\.jar" />