|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-05-07 13:50 UTC] umesh_kant at rediffmail dot com
Description:
------------
SolrClient::query() returns SolrObject instead of
SolrQueryResponse instance
Reproduce code:
---------------
$options = array
(
'hostname' => localhost,
'login' => ,
'password' => ,
'port' => 8983,
);
$client = new SolrClient($options);
$query = new SolrQuery();
$query->setQuery('*:*');
$query->setStart(0);
$query->setRows(50);
$query_response = $client->query($query);
$response = $query_response->getResponse();
Expected result:
----------------
$response should have the SolrObject instance containing the
response.
Actual result:
--------------
line '$response = $query_response->getResponse();' throws
error 'Fatal error: Call to undefined method
SolrObject::getResponse() in......'
When tried to print $response, found that SolrClient::query()
returns SolrObject where as as per documentation it should
return SolrQueryResponse.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 01:00:01 2025 UTC |
Right after I get the response from solr, I called getDebug() method. But it is returning NULL. I print both the response and getDebug using Zend_Debug::dump() and see following: RESPONSE --------------- object(SolrObject)#88 (2) { ["responseHeader"] => object(SolrObject)#89 (3) { ["status"] => int(0) ["QTime"] => int(0) ["params"] => object(SolrObject)#90 (7) { ["sort"] => string(15) "a_name_sort asc" ["indent"] => string(2) "on" ["start"] => string(1) "0" ["q"] => string(20) "a_name_firstLetter:B" ["wt"] => string(3) "xml" ["version"] => string(3) "2.2" ["rows"] => string(2) "20" } } ["response"] => object(SolrObject)#91 (3) { ["numFound"] => int(3) ["start"] => int(0) ["docs"] => array(3) { [0] => object(SolrObject)#92 (11) { ["a_matrix_description"] => string(22) "Band, with cornet solo" ["a_matrix_id"] => string(9) "200000600" ["a_matrix_title"] => string(11) "La danseuse" ["a_name"] => string(15) "Blon, Franz von" ["a_name_firstLetter"] => string(1) "B" ["a_name_sort"] => string(15) "Blon, Franz von" ["a_role"] => string(3) "cmp" ["a_role_sort"] => string(3) "cmp" ["a_talent_id"] => string(5) "40835" ["id"] => string(12) "Artist:40835" ["s_type"] => string(6) "Artist" } [1] => object(SolrObject)#93 (11) { ["a_matrix_description"] => string(31) "Male vocal duet, with orchestra" ["a_matrix_id"] => string(9) "200000500" ["a_matrix_title"] => string(12) "Baffin's Bay" ["a_name"] => string(15) "Bryan, Vincent " ["a_name_firstLetter"] => string(1) "B" ["a_name_sort"] => string(15) "Bryan, Vincent " ["a_role"] => string(3) "lyr" ["a_role_sort"] => string(3) "lyr" ["a_talent_id"] => string(5) "40412" ["id"] => string(12) "Artist:40412" ["s_type"] => string(6) "Artist" } [2] => object(SolrObject)#94 (11) { ["a_matrix_description"] => string(4) "Band" ["a_matrix_id"] => string(9) "200000471" ["a_matrix_title"] => string(20) "John Anderson, my jo" ["a_name"] => string(13) "Burns, Robert" ["a_name_firstLetter"] => string(1) "B" ["a_name_sort"] => string(13) "Burns, Robert" ["a_role"] => string(3) "aut" ["a_role_sort"] => string(3) "aut" ["a_talent_id"] => string(5) "40176" ["id"] => string(12) "Artist:40176" ["s_type"] => string(6) "Artist" } } } } -------------------- getDebug() ----------------- NULL ----------------- Do I need to turn some setting on in SOLR config as well to enable debug info. I will search for any such setting and will post an update in case I have any success in getting the debug info. Thanks, UmeshHi, The original issue 'getting instance of SolrObject instead of SolrQueryResponse' is invalid as inside a wrapper class what we were doing was something like: public function execute() { $updateResponse = $this->_solrClient->query($this- >_solrQuery); return $updateResponse->getResponse(); } And in the controller we were calling execute method. This execute will always return the instance of SolrObject as SolrQueryResponse::getResponse() is being returned. The original issue is not an issue. Thanks for explaining about wt, as of now it only supports xml. That means we are not going to get php serialized data using SolrResponse::getDigestedResponse() as of now? Thanks, UmeshHi iekpo, When can we have options like php and phps to be incorporated in the solr library. Cause for using phpnative we have to specify classes to serialize the response. Solr has implemented response classes like php and phps but we don't have option to specify the same through the solr api.