The beginner SOLR downloaded an example from the Web, but ran the Times following error:
Fatal error:uncaught exception ' apache_solr_httptransportexception ' with message ' + ' Status:bad Request ' In/applicat ions/xampp/xamppfiles/htdocs/phpsolr/solrphpclient/apache/solr/service.php:338 Stack Trace: #0/Applications/XAMPP /xamppfiles/htdocs/phpsolr/solrphpclient/apache/solr/service.php (1170): Apache_solr_service->_sendrawget (' Http://localhos. ') #1/applications/xampp/xamppfiles/htdocs/phpsolr/index.php: apache_solr_service-> Search (' Name:???? ', 0, Ten) #2 {main} thrown in/applications/xampp/xamppfiles/htdocs/phpsolr/solrphpclient/apache/ solr/service.php on line 338
From the Internet to find the answer, most of the schema.xml is not defined field, but I confirm that I use the field are defined, really do not know why, I hope someone knows!!
Reply content:
The beginner SOLR downloaded an example from the Web, but ran the Times following error:
Fatal error:uncaught exception ' apache_solr_httptransportexception ' with message ' + ' Status:bad Request ' In/applicat ions/xampp/xamppfiles/htdocs/phpsolr/solrphpclient/apache/solr/service.php:338 Stack Trace: #0/Applications/XAMPP /xamppfiles/htdocs/phpsolr/solrphpclient/apache/solr/service.php (1170): Apache_solr_service->_sendrawget (' Http://localhos. ') #1/applications/xampp/xamppfiles/htdocs/phpsolr/index.php: apache_solr_service-> Search (' Name:???? ', 0, Ten) #2 {main} thrown in/applications/xampp/xamppfiles/htdocs/phpsolr/solrphpclient/apache/ solr/service.php on line 338
From the Internet to find the answer, most of the schema.xml is not defined field, but I confirm that I use the field are defined, really do not know why, I hope someone knows!!
The first thing I want to say is ... Not all of the milk is called xxx sue ... And not all the mistakes are called 404 ...
This mistake of yours is '400' Status: Bad Request
... Instead of 404 ...
In general, the reason why this error occurs is as you say ... There is no field defined in schema.xml ...
But specifically how to analyze ...
Apache_Solr_Service
This class does not return SOLR's internal error ... So we have to solve it in other ways ...
The first way is relatively simple ... View SOLR's log ... There will be something similar to the following line ...
SEVERE:org.apache.solr.common.SolrException: * * *
Which is the specific cause of the error ...
The second method ... Use a tool that comes with SOLR to call solr admin
...
In this tool you can enter the query manually ... If the query is not valid, it will also show a detailed error message ...
In the circumstances you describe ... Just enter name:????
and click OK ...
With the error message to know how to solve the problem ... Otherwise only rely on the East one hammer West a stick of speculation ... Time-consuming and laborious ...
Just said SOLR reported the wrong ... You don't know why you just want people to know ... I'm sorry ... I don't think anyone will know ...
The words may be a bit heavy ... I'm sorry... But the truth is that ...
First of all, we must learn to describe the problems you encounter in order to hope that others can solve the problem accurately and efficiently ... Do you think it's ...?
Note the arguments that you have when you call Apache_Solr_Service()
the constructor. One pitfall is that the fifth parameter that $compatibilityLayer
needs to be passed should be changed according to your SOLR server version, as you are SOLR 4.0+ should pass new Apache_Solr_Compatibility_Solr4CompatibilityLayer
.
The reason is that SOLR3 and SOLR4 produce different XML formats, and some parameters have compatibility issues when they are used, triggering the HTTP 400 Bad Request
problem. The current solr-php-client uses the SOLR3 standard by default.
Hope to help you.