You are on page 1of 3

Apache Solr | Guia PHP http://www.guiaphp.com.

br/apache-solr-2/

$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
);

$client = new SolrClient($options);

1 de 3 12/03/2014 19:15
Apache Solr | Guia PHP http://www.guiaphp.com.br/apache-solr-2/

$doc = new SolrInputDocument();

$doc->addField('id', 334455);
$doc->addField('cat', 'Software');
$doc->addField('cat', 'Lucene');

$updateResponse = $client->addDocument($doc);

$options = array
(
'hostname' => SOLR_SERVER_HOSTNAME,
'login' => SOLR_SERVER_USERNAME,
'password' => SOLR_SERVER_PASSWORD,
'port' => SOLR_SERVER_PORT,
);

$client = new SolrClient($options);

$query = new SolrQuery();


$query->setQuery('lucene');
$query->setStart(0);
$query->setRows(50);
$query->addField('cat')->addField('features')->addField('id')->addField('timestamp');

$query_response = $client->query($query);
$response = $query_response->getResponse();

Você pode usar estas tags e atributos de HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del
datetime=""> <em> <i> <q cite=""> <strike> <strong>

2 de 3 12/03/2014 19:15
Apache Solr | Guia PHP http://www.guiaphp.com.br/apache-solr-2/

3 de 3 12/03/2014 19:15

You might also like