3
namespace TSEP\Bundle\AdminBundle\Job;
5
use Symfony\Component\DependencyInjection\Container;
6
use Xaav\QueueBundle\JobQueue\Job\AbstractJob;
7
use TSEP\Component\Indexer\Engine\CrawlingEngine;
8
use TSEP\Component\Indexer\Engine\IndexingEngine;
9
use Xaav\QueueBundle\JobQueue\Job\JobInterface;
10
use TSEP\Bundle\SearchBundle\Entity\Profile;
12
class ProcessIndexingRequestJob extends AbstractJob implements JobInterface
19
protected $crawlingEngine;
24
protected $indexingEngine;
31
public function __construct(Profile $profile)
33
$this->profile = $profile;
36
public function setContainer(Container $container = null)
38
$this->container = $container;
41
protected function init()
43
$this->indexingEngine = new IndexingEngine();
44
$this->crawlingEngine = new CrawlingEngine();
47
//TODO: Add this to the profile
48
$this->crawlingEngine->setUserAgent('The Search Engine Project version 2.0');
50
$this->crawlingEngine->setRegularExpression($this->profile->getRegex());
51
$this->crawlingEngine->addQueuedURL($this->profile->getUrl());
53
//TODO: Add custom stopwords
54
$this->indexingEngine->setStopwords(array());
57
public function process($count)
59
//TODO: Save state between passes
63
if ($page = $this->crawlingEngine->crawl()) {
64
$page = $this->indexingEngine->parse($page);
66
$em = $this->get('doctrine')->getEntityManager();
b'\\ No newline at end of file'