コード例 #1
0
ファイル: SolrFacade.php プロジェクト: rmzamora/SolrBundle
 public function clearIndex()
 {
     try {
         $this->solrClient->deleteByQuery('*:*');
         $this->solrClient->commit();
     } catch (\Exception $e) {
         $errorEvent = new ErrorEvent(null, null, 'clear-index');
         $errorEvent->setException($e);
         $this->eventManager->handle(EventManager::ERROR, $errorEvent);
     }
 }
コード例 #2
0
<?php

define('SOLR_SERVER_HOSTNAME', 'localhost');
define('SOLR_SERVER_PORT', '8983');
define('SOLR_SERVER_PATH', 'solr/europeana');
$options = array('hostname' => SOLR_SERVER_HOSTNAME, 'port' => SOLR_SERVER_PORT, 'path' => SOLR_SERVER_PATH);
$client = new SolrClient($options);
$client->deleteByQuery("*:*");
$client->commit();
コード例 #3
0
ファイル: m_backend.php プロジェクト: ngothanhduoc/wap_tao
 public function deleteKeywordsintoSolrDocument($id_news, $type)
 {
     try {
         $this->config->load('solr');
         $solr = $this->config->item('solr');
         $options = array('hostname' => $solr['SOLR_SERVER_HOSTNAME'], 'login' => $solr['SOLR_SERVER_USERNAME'], 'password' => $solr['SOLR_SERVER_PASSWORD'], 'port' => $solr['SOLR_SERVER_PORT'], 'path' => 'solr/keywords');
         $client = new SolrClient($options);
         $client->deleteByQuery("id_news:{$id_news} AND type:{$type}");
         return $client->commit();
     } catch (Exception $e) {
         return FALSE;
     }
 }
コード例 #4
0
ファイル: solr.php プロジェクト: jbree857/Techknowledgy
<?php

$core = 'techknowledgy_core';
#$core = 'demo';
$options = array('hostname' => 'localhost', 'port' => 8983, 'timeout' => 10, 'path' => '/solr/' . $core);
$client = new SolrClient($options);
if (!$client->ping()) {
    exit('Solr service not responding.');
} else {
    print "Worked!";
}
# CODE FOR CLEARING CORE OF ALL DOCS ===>
$deleteResponse = $client->deleteByQuery("*.htm*");
$client->commit(true);
print_r($deleteResponse->getResponse());
# <=== END OF CODE FOR CLEARING CORE OF ALL DOCS
# CODE FOR ADDING NEW DOC ===>
#$doc = new SolrInputDocument();
#$doc->addField('id', '090945');
#$doc->addField('link', 'www.test.com');
#$doc->addField('text', 'this is another test');
#$updateResponse = $client->addDocument($doc);
#$client->commit(true);
#print_r($updateResponse->getResponse());
# <=== END OF ADDING NEW DOC CODE
# QUERYING DOCUMENTS CODE ===>
#$query = new SolrQuery();
#$query->setQuery('technology');
#$query->setStart(0);
#$query->setRows(50);
#$query->addField('url')->addField('title')->addField('host')->addField('content');