diff --git a/reference/solr/examples.xml b/reference/solr/examples.xml index a6670bc576..6f4fe82bbc 100755 --- a/reference/solr/examples.xml +++ b/reference/solr/examples.xml @@ -3,9 +3,61 @@ &reftitle.examples; - - Examples of how to use the Apache Solr extension in PHP - + + + Examples of how to use the Apache Solr extension in PHP + + + Contents of the BootStrap file + + + +]]> + + + + Adding a document to the index @@ -704,6 +756,78 @@ SolrObject Object + + Connecting to SSL-Enabled Server + + SOLR_SERVER_HOSTNAME, + 'login' => SOLR_SERVER_USERNAME, + 'password' => SOLR_SERVER_PASSWORD, + 'port' => SOLR_SERVER_PORT, + 'timeout' => SOLR_SERVER_TIMEOUT, + 'secure' => SOLR_SECURE, + 'ssl_cert' => SOLR_SSL_CERT_ONLY, + 'ssl_key' => SOLR_SSL_KEY, + 'ssl_keypassword' => SOLR_SSL_KEYPASSWORD, + 'ssl_cainfo' => SOLR_SSL_CAINFO, +); + +$client = new SolrClient($options); + +$query = new SolrQuery('*:*'); + +$query->setFacet(true); + +$query->addFacetField('cat')->addFacetField('name')->setFacetMinCount(2)->setFacetMinCount(4, 'name'); + +$updateResponse = $client->query($query); + +$response_array = $updateResponse->getResponse(); + +$facet_data = $response_array->facet_counts->facet_fields; + +print_r($facet_data); + +?> +]]> + + &example.outputs.similar; + + SolrObject Object + ( + [electronics] => 14 + [memory] => 3 + [Lucene] => 2 + [Software] => 2 + [card] => 2 + [connector] => 2 + [drive] => 2 + [graphics] => 2 + [hard] => 2 + [monitor] => 2 + [search] => 2 + [software] => 2 + ) + + [name] => SolrObject Object + ( + [gb] => 6 + ) + +) +]]> + + +