{"id":7234,"date":"2014-06-01T04:43:22","date_gmt":"2014-06-01T04:43:22","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/06\/01\/why-php-solr-extension-gives-exception-unsuccessful-query-request-collection-of-common-programming-errors\/"},"modified":"2014-06-01T04:43:22","modified_gmt":"2014-06-01T04:43:22","slug":"why-php-solr-extension-gives-exception-unsuccessful-query-request-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/06\/01\/why-php-solr-extension-gives-exception-unsuccessful-query-request-collection-of-common-programming-errors\/","title":{"rendered":"Why PHP Solr extension gives exception &ldquo;Unsuccessful query request&rdquo;-Collection of common programming errors"},"content":{"rendered":"<p>I use PHP Solr extension and it when I run the code below I get the exception:<\/p>\n<blockquote>\n<p>Fatal error: Uncaught exception &#8216;SolrClientException&#8217; with message &#8216;Unsuccessful query request : Response Code 404.<\/p>\n<\/blockquote>\n<p>I do not understand, what is wrong, I also use Solr client successfully.<\/p>\n<pre><code>include \"bootstrap.php\";\n\n$options = array\n(\n    'hostname' =&gt; SOLR_SERVER_HOSTNAME,\n    'login'    =&gt; SOLR_SERVER_USERNAME,\n    'password' =&gt; SOLR_SERVER_PASSWORD,\n    'port'     =&gt; SOLR_SERVER_PORT,\n);\n\n$client = new SolrClient($options);    \n$query = new SolrQuery();   \n$query-&gt;setQuery('lucene');    \n$query-&gt;setStart(0);    \n$query-&gt;setRows(50);    \n$query-&gt;addField('cat')-&gt;addField('features')-&gt;addField('id')-&gt; addField('timestamp');    \n$query_response = $client-&gt;query($query);    \n$response = $query_response-&gt;getResponse();    \nprint_r($response);    \n?&gt;\n<\/code><\/pre>\n<p><strong>my bootstrap.php file is:<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I use PHP Solr extension and it when I run the code below I get the exception: Fatal error: Uncaught exception &#8216;SolrClientException&#8217; with message &#8216;Unsuccessful query request : Response Code 404. I do not understand, what is wrong, I also use Solr client successfully. include &#8220;bootstrap.php&#8221;; $options = array ( &#8216;hostname&#8217; =&gt; SOLR_SERVER_HOSTNAME, &#8216;login&#8217; =&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7234","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7234","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7234"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7234\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7234"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7234"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7234"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}