您好,欢迎访问一九零五行业门户网

solr 索引mysql DIH 链接

download the jdbc driver download the jdbc driver for mysql from http://mysql.spd.co.il/downloads/connector-j/mysql-connector-java-3.1.14.zip put the mysql-connector-java-3.1.14-bin.jar in solr dir/example/lib configuring solr to use mysql
download the jdbc driverdownload the jdbc driver for mysql from http://mysql.spd.co.il/downloads/connector-j/mysql-connector-java-3.1.14.zip
put the mysql-connector-java-3.1.14-bin.jar in
solr dir/example/lib
configuring solr to use mysqlsolr can be configured to connect to a mysql data base using the dataimporthandler. to do so first in
solrconfig.xml
(this file would be in
solr dir/example/conf
) add a new requesthandler which is handled by dih (dataimporthandler).
name=/dataimport
class=org.apache.solr.handler.dataimport.dataimporthandler>
name=defaults>
name=config>data-config.xml>
>
>

create a new file called data-config.xml in the same directory and configure the database connection and table schema to reflect your database structure.
sample data-config.xml
>
type=jdbcdatasource
driver=com.mysql.jdbc.driver
url=jdbc:mysql://server/database
user=username
password=password/>
name=content>
name=node query=select node.nid as nid,node_revisions.body as body,node_revisions.title as title from node,node_revisions where node.status = 1 and node.nid = node_revisions.nid and node.vid = node_revisions.vid>
column=nid name=id />
column=body name=body />
column=title name=title />
>
>
>

the datasource configuration attributes , query in entity tag and database fields must be modified to match your database structure. the query given in the example is a simple join of the drupal node and node revisions tables.
now restart or start apachesolr using java -jar start.jar.
hit the full-commit url (http://server:port/solr/dataimport?command=full-import) and your website would start getting indexed.
>
name=responseheader>
name=status>0>
name=qtime>0>
>
name=initargs>
name=defaults>
name=config>data-config.xml>
>
>
name=command>full-import>
name=status>idle>
name=importresponse/>
name=statusmessages>
name=total requests made to datasource>1>
name=total rows fetched>1056>
name=total documents skipped>0>
name=full dump started>2010-02-22 14:46:35>
name=>
indexing completed. added/updated: 1056 documents. deleted 0 documents.
>
name=committed>2010-02-22 14:46:42>
name=optimized>2010-02-22 14:46:42>
name=total documents processed>1056>
name=time taken >0:0:6.562>
>
name=warning>
this response format is experimental. it is likely to change in the future.
>
>




其它类似信息

推荐信息