【问题标题】:Solr HTTP Error 'Unknown Field' Error using Solarium使用日光浴室的 Solr HTTP 错误“未知字段”错误
【发布时间】:2012-10-02 17:23:18
【问题描述】:

我正在尝试使用 Solarium 和 PHP 从 MySQL 索引表。为了测试,我有一个国家列表,并在 Solr 中设置了一个核心来反映我在查询中检索的字段。尝试使用 Solarium 添加这些内容时出现错误:

Fatal error: Uncaught exception 'Solarium_Client_HttpException' with message 'Solr HTTP error: ERROR: [doc=1] unknown field 'code' (400)' in solariumQuickStart\Library\Solarium\Result.php on line 98
( ! ) Solarium_Client_HttpException: Solr HTTP error: ERROR: [doc=1] unknown field 'code' (400) in solariumQuickStart\Library\Solarium\Result.php on line 98

这是我的代码:

foreach($worldDBRecords as $record)
{

    // create a new document for the data
    $doc = $update->createDocument();
    $doc->code = $record[0];
    $doc->name = $record[1];
    $doc->continent = $record[2];
    $doc->region = $record[3];
    $doc->population = $record[4];
    $update->addDocument($doc);
}

$update->addCommit();
$result = $client->update($update);

我与 Solr 的连接正常,并且我在 Solarium_Client 配置中定义了核心。我的架构文件中也定义了代码字段,但它没有被识别。任何帮助表示赞赏。谢谢。

【问题讨论】:

  • 在您的 schema.xml 文件中定义代码字段后,您是否停止并重新启动了 Solr?在 Solr 重新启动之前,更改不会反映。
  • 感谢您的回复,佩奇。进行任何更改后,我确实重新启动了 Solr。由于 Solarium 只向 Solr 发送文档,并没有真正读取模式文件,我相信问题出在我的 Solr Core 配置上。仍在努力解决这个问题。

标签: php mysql solr solarium


【解决方案1】:

我重新设置了 Solr 核心以确保我的配置正确。另外,我的 Solarium 配置中缺少“适配器选项”设置,它在此之后起作用:

$config = array(
'adapteroptions' => array(
'host' => 'localhost',
'port' => 8983,
'path' => '/solr/',
'core' => 'world'
)
);

【讨论】:

    猜你喜欢
    • 2013-07-08
    • 1970-01-01
    • 1970-01-01
    • 2019-05-15
    • 2016-08-01
    • 2016-03-03
    • 2013-07-04
    • 2016-03-12
    • 1970-01-01
    相关资源
    最近更新 更多