【问题标题】:SOLR PHP MYSQL IntegrationSOLR PHP MYSQL 集成
【发布时间】:2023-04-05 00:02:01
【问题描述】:

我是 Solr 的新手,我正在尝试将它与 Mysql 和 PHP 集成。 我让 Solr 服务器运行,并且我也配置了 db 模式。但是当我访问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>

【问题讨论】:

  • -1 请发布您的代码的一部分,并更具体地说明您到目前为止所做的尝试。你说你试图访问数据,你到底用了什么代码?
  • 我已经添加了我的 data-config.xml sn-p。
  • solr 定义数据源是不够的。你需要在某个地方使用它。您需要一种特殊类型的请求处理程序,名为 dataimport-handler。这些需要在您的 solrconfig.xml 中声明。我假设你没有对 solrconfig.xml 做任何事情?如果还有,请发帖...

标签: php mysql solr indexing lucene


【解决方案1】:

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

您可以在分发版的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 目录中。

只要您有followed the steps in the wiki for setting up logging,Solr 的常规日志中也应该记录一个错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-05
    • 1970-01-01
    • 1970-01-01
    • 2011-01-09
    • 1970-01-01
    • 2012-08-14
    • 1970-01-01
    相关资源
    最近更新 更多