[SearchEngine] Update commands

This commit is contained in:
Romain Neutron
2012-08-24 11:44:10 +02:00
parent d120277cbf
commit bfed1a4d60
5 changed files with 33 additions and 3 deletions

View File

@@ -15,10 +15,12 @@
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
use Alchemy\Phrasea\Command\Command;
use Alchemy\Phrasea\SearchEngine\PhraseaEngineQueryParser;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Alchemy\Phrasea\Command\Command;
class module_console_checkExtension extends Command
{
@@ -147,7 +149,7 @@ class module_console_checkExtension extends Command
$tbases[$kbase]["searchcoll"] = $tcoll;
$tbases[$kbase]["mask_xor"] = $tbases[$kbase]["mask_and"] = 0;
$qp = new searchEngine_adapter_phrasea_queryParser($this->container);
$qp = new PhraseaEngineQueryParser();
$treeq = $qp->parsequery($input->getOption('query'));
$arrayq = $qp->makequery($treeq);

View File

@@ -201,6 +201,9 @@ class module_console_fieldsMerge extends Command
'value' => $data,
)), true);
}
$this->getService('phraseanet.SE')->updateRecord($record);
unset($record);
}

View File

@@ -38,6 +38,7 @@ class module_console_fileEnsureProductionSetting extends Command
, 'checkDatabaseScope'
, 'checkTeamplateEngineService'
, 'checkOrmService'
, 'checkSearchEngineService'
, 'checkCacheService'
, 'checkOpcodeCacheService'
, 'checkBorderService'
@@ -98,6 +99,9 @@ class module_console_fileEnsureProductionSetting extends Command
case 'checkOrmService' :
$display = "ORM";
break;
case 'checkSearchEngineService':
$display = 'Search Engine';
break;
case 'checkCacheService' :
$display = "Cache";
break;
@@ -510,6 +514,22 @@ class module_console_fileEnsureProductionSetting extends Command
return;
}
private function checkSearchEngineService(OutputInterface $output)
{
$SEName = $this->configuration->getSearchEngine();
$configuration = $this->configuration->getService($SEName);
try {
$service = Core\Service\Builder::create(\bootstrap::getCore(), $configuration);
$work_message = '<info>Works !</info>';
} catch (\Exception $e) {
$work_message = sprintf('<error>Failed : %s !</error>', $e->getMessage());
$this->errors ++;
}
$output->writeln(sprintf("\t--> Verify ORM engine <info>%s</info> : %s", $SEName, $work_message));
}
private function checkOrmService(OutputInterface $output)
{
$ormName = $this->configuration->getOrm();

View File

@@ -509,6 +509,7 @@ class task_period_RecordMover extends task_appboxAbstract
if (array_key_exists('coll', $row)) {
$coll = collection::get_from_coll_id($this->dependencyContainer, $databox, $row['coll']);
$rec->move_to_collection($coll, $this->dependencyContainer['phraseanet.appbox']);
$this['phraseanet.SE']->updateRecord($rec);
if ($logsql) {
$this->log(sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
}
@@ -524,6 +525,7 @@ class task_period_RecordMover extends task_appboxAbstract
}
$status = implode('', $status);
$rec->set_binary_status($status);
$this['SearchEngine']->updateRecord($rec);
if ($logsql) {
$this->log(sprintf("on sbas %s set rid %s status to %s \n", $row['sbas_id'], $row['record_id'], $status));
}
@@ -534,12 +536,14 @@ class task_period_RecordMover extends task_appboxAbstract
if ($row['deletechildren'] && $rec->is_grouping()) {
foreach ($rec->get_children() as $child) {
$child->delete();
$this['SearchEngine']->removeRecord($child);
if ($logsql) {
$this->log(sprintf("on sbas %s delete (grp child) rid %s \n", $row['sbas_id'], $child->get_record_id()));
}
}
}
$rec->delete();
$this['SearchEngine']->removeRecord($rec);
if ($logsql) {
$this->log(sprintf("on sbas %s delete rid %s \n", $row['sbas_id'], $rec->get_record_id()));
}

View File

@@ -1632,7 +1632,8 @@ class task_period_archive extends task_abstract
$story->set_binary_status(databox_status::operation_or($this->dependencyContainer, $stat0, $stat1));
$story->rebuild_subdefs();
$story->reindex();
$this['phraseanet.SE']->addStory($story);
$media = $databox = null;