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 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
Solr 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).
<span><span><requestHandler</span>
<span>name</span>
=<span>"/dataimport"</span>
</span>
<br />
<span> <span>class</span>
=<span>"org.apache.solr.handler.dataimport.DataImportHandler"</span>
<span>></span>
</span>
<br />
<span><span><lst</span>
<span>name</span>
=<span>"defaults"</span>
<span>></span>
</span>
<br />
<span><span><str</span>
<span>name</span>
=<span>"config"</span>
<span>></span>
</span>
data-config.xml<span><span></str<span>></span>
</span>
</span>
<br />
<span><span></lst<span>></span>
</span>
</span>
<br />
<span><span></requestHandler<span>><br />
<br />
</span>
</span>
</span>
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
<span><span><dataConfig<span>></span>
</span>
</span>
<br />
<span><span><dataSource</span>
<span>type</span>
=<span>"JdbcDataSource"</span>
</span>
<br />
<span> <span>driver</span>
=<span>"com.mysql.jdbc.Driver"</span>
</span>
<br />
<span> <span>url</span>
=<span>"jdbc:mysql://SERVER/DATABASE"</span>
</span>
<br />
<span> <span>user</span>
=<span>"USERNAME"</span>
</span>
<br />
<span> <span>password</span>
=<span>"PASSWORD"</span>
<span>/></span>
</span>
<br />
<span><span><document</span>
<span>name</span>
=<span>"content"</span>
<span>></span>
</span>
<br />
<span><span><entity</span>
<span>name</span>
=<span>"node"</span>
<span>query</span>
=<span>"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"</span>
<span>></span>
</span>
<br />
<span><span><field</span>
<span>column</span>
=<span>"nid"</span>
<span>name</span>
=<span>"id"</span>
<span>/></span>
</span>
<br />
<span><span><field</span>
<span>column</span>
=<span>"body"</span>
<span>name</span>
=<span>"body"</span>
<span>/></span>
</span>
<br />
<span><span><field</span>
<span>column</span>
=<span>"title"</span>
<span>name</span>
=<span>"title"</span>
<span>/></span>
</span>
<br />
<span><span></entity<span>></span>
</span>
</span>
<br />
<span><span></document<span>></span>
</span>
</span>
<br />
<span><span></dataConfig<span>><br />
</span>
</span>
</span>
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.
BIWEB电脑商城站采用PHP5+PDO_mysql+MYSQL+SMARTY程序架构,在WINDOWS、LINUX、UNIX下均表现优异,BIWEB的链接系统使得整个网站更像纯静态网页网站,并使全站链接最大只有3层,对搜索引擎非常友好,利于搜索引擎全站收录。
111
<span><span><response<span>></span> </span> </span> <br /> <br /> <span><span><lst</span> <span>name</span> =<span>"responseHeader"</span> <span>></span> </span> <br /> <span><span><int</span> <span>name</span> =<span>"status"</span> <span>></span> </span> 0<span><span></int<span>></span> </span> </span> <br /> <span><span><int</span> <span>name</span> =<span>"QTime"</span> <span>></span> </span> 0<span><span></int<span>></span> </span> </span> <br /> <span><span></lst<span>></span> </span> </span> <br /> <br /> <span><span><lst</span> <span>name</span> =<span>"initArgs"</span> <span>></span> </span> <br /> <br /> <span><span><lst</span> <span>name</span> =<span>"defaults"</span> <span>></span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"config"</span> <span>></span> </span> data-config.xml<span><span></str<span>></span> </span> </span> <br /> <span><span></lst<span>></span> </span> </span> <br /> <span><span></lst<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"command"</span> <span>></span> </span> full-import<span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"status"</span> <span>></span> </span> idle<span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"importResponse"</span> <span>/></span> </span> <br /> <br /> <span><span><lst</span> <span>name</span> =<span>"statusMessages"</span> <span>></span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"Total Requests made to DataSource"</span> <span>></span> </span> 1<span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"Total Rows Fetched"</span> <span>></span> </span> 1056<span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"Total Documents Skipped"</span> <span>></span> </span> 0<span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"Full Dump Started"</span> <span>></span> </span> 2010-02-22 14:46:35<span><span></str<span>></span> </span> </span> <br /> <br /> <span><span><str</span> <span>name</span> =<span>""</span> <span>></span> </span> <br /> Indexing completed. Added/Updated: 1056 documents. Deleted 0 documents.<br /> <span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"Committed"</span> <span>></span> </span> 2010-02-22 14:46:42<span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"Optimized"</span> <span>></span> </span> 2010-02-22 14:46:42<span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"Total Documents Processed"</span> <span>></span> </span> 1056<span><span></str<span>></span> </span> </span> <br /> <span><span><str</span> <span>name</span> =<span>"Time taken "</span> <span>></span> </span> 0:0:6.562<span><span></str<span>></span> </span> </span> <br /> <span><span></lst<span>></span> </span> </span> <br /> <br /> <span><span><str</span> <span>name</span> =<span>"WARNING"</span> <span>></span> </span> <br /> This response format is experimental. It is likely to change in the future.<br /> <span><span></str<span>></span> </span> </span> <br /> <span><span></response<span>></span> </span> </span>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号