コード例 #1
0
 function emptyAction()
 {
     //$log = new Kutu_Log();
     //$registry = Zend_Registry::getInstance();
     //$conf = $registry->get('config');
     $solr = new Apache_Solr_Service('localhost', '8983', '/solr/core0');
     $solr->deleteByQuery('*:*');
     $solr->commit();
     //$log->info("Indexing empty successfully");
     $this->view->success = true;
 }
コード例 #2
0
ファイル: Common.php プロジェクト: 032404cxd/xrace_main
 function delete_search($id)
 {
     if (!class_exists('Apache_Solr_Service', false)) {
         require dirname(dirname(dirname(__FILE__))) . '/lib/Third/SolrPhpClient/Apache/Solr/Service.php';
     }
     $CommonConfig = (require dirname(dirname(dirname(dirname(__FILE__)))) . "/CommonConfig/commonConfig.php");
     if (is_array($CommonConfig['SOLR_DOMAIN'])) {
         foreach ($CommonConfig['SOLR_DOMAIN'] as $solrDomain) {
             $solr = new Apache_Solr_Service($solrDomain, $CommonConfig['SOLR_PORT'], '/solr');
             $solr->deleteByQuery('id:' . $id);
             file_get_contents('http://' . $solrDomain . ':' . $CommonConfig['SOLR_PORT'] . '/solr/update/json?commit=true');
         }
     } else {
         $solr = new Apache_Solr_Service($CommonConfig['SOLR_DOMAIN'], $CommonConfig['SOLR_PORT'], '/solr');
         $solr->deleteByQuery('id:' . $id);
         file_get_contents('http://' . $CommonConfig['SOLR_DOMAIN'] . ':' . $CommonConfig['SOLR_PORT'] . '/solr/update/json?commit=true');
     }
 }
コード例 #3
0
 * (at your option) any later version.
 *
 * This code is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * @category    Application
 * @author      Henning Gerhardt <*****@*****.**>
 * @copyright   Copyright (c) 2010
 *              Saechsische Landesbibliothek - Staats- und Universitaetsbibliothek Dresden (SLUB)
 * @license     http://www.gnu.org/licenses/gpl.html General Public License
 * @version     $Id$
 */
define('APPLICATION_ENV', 'production');
// basic bootstrapping
require_once dirname(__FILE__) . '/../common/bootstrap.php';
$config = Zend_Registry::get('Zend_Config');
$host = $config->searchengine->solr->host;
$port = $config->searchengine->solr->port;
$baseUri = $config->searchengine->solr->path;
$EOL = "\n";
$solr = new Apache_Solr_Service($host, $port, $baseUri);
if (false === $solr->ping()) {
    echo 'Could not connect to solr service.' . $EOL;
    return;
}
$solr->deleteByQuery('*:*');
$solr->commit();
$solr->optimize();
echo 'Cleaning solr index on "' . $host . ':' . $port . $baseUri . '" done.' . $EOL;
コード例 #4
0
 public function testDeleteByQuery()
 {
     // set a mock transport
     $mockTransport = $this->getMockHttpTransportInterface();
     // setup expected call and response
     $mockTransport->expects($this->once())->method('performPostRequest')->will($this->returnValue(Apache_Solr_HttpTransport_ResponseTest::get200Response()));
     $fixture = new Apache_Solr_Service();
     $fixture->setHttpTransport($mockTransport);
     $fixture->deleteByQuery("*:*");
 }
コード例 #5
0
ファイル: base.class.php プロジェクト: eappl/prototype
 function delete_search($id)
 {
     if (!class_exists('Apache_Solr_Service', false)) {
         require TIPASK_ROOT . '/api/SolrPhpClient/Apache/Solr/Service.php';
     }
     if (is_array($this->onlineConfig['SOLR_DOMAIN'])) {
         foreach ($this->onlineConfig['SOLR_DOMAIN'] as $solrDomain) {
             $solr = new Apache_Solr_Service($solrDomain, $this->onlineConfig['SOLR_PORT'], '/solr');
             $solr->deleteByQuery('id:' . $id);
             file_get_contents('http://' . $solrDomain . ':' . $this->onlineConfig['SOLR_PORT'] . '/solr/update/json?commit=true');
         }
     } else {
         $solr = new Apache_Solr_Service($this->onlineConfig['SOLR_DOMAIN'], $this->onlineConfig['SOLR_PORT'], '/solr');
         $solr->deleteByQuery('id:' . $id);
         file_get_contents('http://' . $this->onlineConfig['SOLR_DOMAIN'] . ':' . $this->onlineConfig['SOLR_PORT'] . '/solr/update/json?commit=true');
     }
 }