2012-08-27 55 views
1

我使用Solarium從PHP訪問Solr。當我使用Solarium執行正常的選擇查詢時,一切正常。Solr HTTP錯誤:未找到(404)使用日光浴室

問題:當我嘗試執行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_Object/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 
) 

回答

0

您必須Solr的配置morelikethis處理程序。你可能有一個選擇處理程序,所以標準選擇工作。但對於morelikethis查詢類型,您需要配置另一個處理程序。

欲瞭解更多信息,請參閱:http://wiki.apache.org/solr/MoreLikeThisHandler