SOLR PHP MYSQL Integration


SOLR PHP MYSQL Integration

我是Solr的新手,我正试图将它与Mysql和PHP集成。我得到了Solr服务器运行,我也配置了数据库模式。但是当我尝试访问collection1 -> data import时,我得到以下错误:

sorry, no dataimport-handler defined!

我在谷歌上搜索了很多,但我仍然很困惑:

    如何让solr在我的php web应用程序上工作。
  • 它究竟是如何工作的?

这里是我的data-config。xml文件

  <dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
 url="jdbc:mysql://localhost:81/solr" user="root" password=""
 batchSize="1" />
           <document name="products">
           <entity name="products_data" query="SELECT * FROM products">
            <field column="product_id" name="product_id" />
            <field column="product_name" name="product_name" />     
            <field column="product_description" name="product_description" />
            <field column="product_price" name="product_price" />
           </entity>
          </document>
   </dataConfig>

消息是Solr抱怨没有定义solr.DataImportHandler类型的requestHandler

您可以在分布中找到example/example-DIH/solr/db/conf中这种处理程序的示例定义。

<requestHandler name="/dataimport" class="solr.DataImportHandler">
  <lst name="defaults">
    <str name="config">db-data-config.xml</str>
  </lst>
</requestHandler>

您必须更新它以匹配您自己保存的配置文件名,并确保它位于conf目录中。

也应该有一个错误记录到Solr的常规日志中,只要您按照wiki中设置日志记录的步骤操作。