public function initialize() { if ($this->configuration instanceof sfApplicationConfiguration) { sfLuceneableToolkit::registerZend(); } }
static public function registerZend() { if (self::$zendLoaded) { return; } set_include_path(dirname(__FILE__).'/../vendor'.PATH_SEPARATOR.get_include_path()); require_once dirname(__FILE__).'/../vendor/Zend/Loader/Autoloader.php'; Zend_Loader_Autoloader::getInstance(); self::prepareZendSearchLucene(); self::$zendLoaded = true; }
public function init() { $hasMaxRecordLimit = ($this->getMaxRecordLimit() !== false); $maxRecordLimit = $this->getMaxRecordLimit(); $hits = sfLuceneableToolkit::getHits($this->model, $this->search); $count = count($hits); $this->setNbResults($hasMaxRecordLimit ? min($count, $maxRecordLimit) : $count); if (($this->getPage() == 0 || $this->getMaxPerPage() == 0)) { $this->setLastPage(0); } else { $this->setLastPage(ceil($this->getNbResults() / $this->getMaxPerPage())); } $this->results = $hits; }
/** * @see sfTask */ protected function execute($arguments = array(), $options = array()) { $this->logSection('propel', 'generating lucene indexes...'); $generatorManager = new sfGeneratorManager($this->configuration); $luceneableModels = $generatorManager->generate($options['generator-class'], array( 'connection' => $options['connection'] )); $databaseManager = new sfDatabaseManager($this->configuration); foreach ($luceneableModels as $luceneableModel) { $this->logSection('propel', sprintf('optimizing lucene index for %s model', $luceneableModel)); sfLuceneableToolkit::optimizeIndex($luceneableModel); } $this->logSection('propel', 'done...'); }
public function find($limit = 10) { $hits = sfLuceneableToolkit::getHits($this->_model, $this->_queryString); return PropelQuery::from($this->_model)->findPks($hits); }