I am using Solarium to access Solr from PHP. When I perform a normal select query using Solarium everything works fine.
Problem: When I attempt to do a MoreLikeThis query, I get the following error when trying to execute the query. What went wrong, and how can it be fixed?
Solr HTTP error: Not Found (404)
Location:
/home/mysite/public_html/application/libraries/Solarium/Result.php on line 98
PHP Code
$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);
I probed into the Solarium_Client_Response_Object
at /solarium/Client.php
and found the response received to be
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
)
You need to have the morelikethis handler configured in Solr. You probably have a select handler, so the standard select works. But for the morelikethis querytype you need to have another handler configured.
For more info see: http://wiki.apache.org/solr/MoreLikeThisHandler