Solr learning (6) -- Solr's PHP client solr returns results in xml or json format, not like the pretty and refreshing interface we usually use google or Baidu, in fact, solr is only responsible for data query and return, and is not responsible for display. if you want to generate a google-like interface, you can also use the solr php client to perform query through the client, solr learning (6)-Solr PHP client
Solr query return is only in xml or json format. it is not as elegant and refreshing as we usually use google or Baidu. In fact, solr is only responsible for data query and return and is not responsible for display, if you want to generate an interface like google, you can also use the solr php client to query it through the client and then display it through php code.
In this article, one server uses tomcat to run solr, and the other server uses apache to interact with and display users.
?
There are also several solr php clients. This article chooses a simple and easy to use ,? Php-solr-client. the Project address is? Http://code.google.com/p/solr-php-client/, download and decompress it to the website root directory of apache.
?
? The following is a simple query example:
?
?
search($query, 0, $limit); } catch (Exception $e) { // in production you'd probably log or email this error to an admin // and then show a special message to the user but for this example // we're going to show the full exception die("SEARCH EXCEPTION{$e->__toString()}
"); }}?> PHP Solr Client Example
response->numFound; $start = min(1, $total); $end = min($limit, $total);?> Results
-
of
:
response->docs as $doc) {?>
-
?
Enter a car. The result is as follows?
After the solr query is successfully connected, you can perform some optimization on the artist to have a query interface like Baidu.