1

我正在使用 Solarium 从 PHP 访问 Solr。当我使用 Solarium 执行正常的选择查询时,一切正常。

问题:当我尝试执行 MoreLikeThis 查询时,尝试执行查询时出现以下错误。出了什么问题,如何解决?

Solr HTTP error: Not Found (404)

Location:
/home/mysite/public_html/application/libraries/Solarium/Result.php on line 98

PHP 代码

$client = new Solarium_Client($config);

$query = $client->createMoreLikeThis()
                ->setQuery('id:' . $product_id)
                ->setMltFields('title, description')
                ->setMinimumDocumentFrequency(1)
                ->setMinimumTermFrequency(1)
                ->setInterestingTerms('details')
                ->setMatchInclude(false)
                ->setRows(10);
$resultset = $client->select($query);

我调查了Solarium_Client_Response_Objectat/solarium/Client.php并发现收到的响应是

Solarium_Client_Response Object
(
    [_headers:protected] => Array
        (
            [0] => HTTP/1.1 404 Not Found
            [1] => Server: Apache-Coyote/1.1
            [2] => Content-Type: text/html;charset=utf-8
            [3] => Content-Length: 979
            [4] => Date: Mon, 27 Aug 2012 12:03:42 GMT
            [5] => Connection: close
        )

    [_body:protected] => 
    [_statusCode:protected] => 404
    [_statusMessage:protected] => Not Found
)
4

1 回答 1

0

您需要在 Solr 中配置 morelikethis 处理程序。您可能有一个选择处理程序,因此标准选择有效。但是对于 morelikethis 查询类型,您需要配置另一个处理程序。

有关更多信息,请参阅:http ://wiki.apache.org/solr/MoreLikeThisHandler

于 2012-08-28T13:15:39.113 回答