This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head><title>Add docs</title></head><body> | |
<?php | |
require('../library/Solarium/Autoloader.php'); | |
Solarium_Autoloader::register(); | |
// create a client instance | |
$client = new Solarium_Client(); | |
// create a new document for the data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require('../library/Solarium/Autoloader.php'); | |
Solarium_Autoloader::register(); | |
$client = new Solarium_Client(); | |
$client->setHost('192.168.1.2'); | |
$client->setCore('geonames'); | |
$query = new Solarium_Query_Select; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[solr] | |
; client connection settings | |
client.host = "192.168.1.2" | |
client.port = 8983 | |
client.path = /solr/ | |
client.core = geonames | |
; a complex select query based on configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// make Solarium available | |
require('Solarium/Autoloader.php'); | |
Solarium_Autoloader::register(); | |
// create a client instance | |
$client = new Solarium_Client; | |
$client->setHost('192.168.1.2'); | |
$client->setPort(8983); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this example assumes Solarium and Zend_Framework are in your include_path | |
// make Solarium available | |
require('Solarium/Autoloader.php'); | |
Solarium_Autoloader::register(); | |
// make Zend Framework available | |
require('Zend/Loader/Autoloader.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// this is the easiest way to add a delete command, by using one of the helper methods: | |
$query = new Solarium_Query_Update; | |
$query->addDeleteQuery('*:*'); | |
$query->addCommit(); | |
$client->update($query); | |
// alternatively you can construct the command yourself: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// A query without any settings will use default values. | |
// This will result in a "*:*" query, 10 rows, all fields. | |
$query = new Solarium_Query_Select; | |
$result = $client->select($query); | |
echo 'Number of results found: ' . $result->getNumFound(); | |
// The resultset is iterable, you could also use $result->getDocuments() to get an array with documents. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client = new Solarium_Client; | |
$client->setHost('127.0.0.1'); | |
$client->setPort(8983); | |
$client->setPath('/solr/'); | |
$client->setCore('core0'); | |
$query = new Solarium_Query_Ping; | |
$result = $client->ping($query); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo Solarium_Version::VERSION; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$config = array( | |
'host' => '192.168.1.2', | |
'port' => 8983, | |
'path' => '/solr/', | |
'core' => 'geonames', | |
); | |
$client = new Solarium_Client($config); |