Example #1
0
 /**
  * Run the crawler until the search is finished or until
  * the search is deleted.
  *
  * @param \App\Search $search
  * @return bool
  */
 public function run(Search $search)
 {
     $this->search = $search;
     $this->domainName = $this->getDomainName($this->search->entrypoint);
     // crawl search's entrypoint url
     $this->crawl($this->search->entrypoint, true);
     // crawl all search's urls
     while ($url = $this->getNextNotCrawledUrl()) {
         $this->crawl($url);
         // check if the search has been deleted during the crawl process
         if ($this->searchIsDeletedOrFinished()) {
             return false;
         }
     }
     // this search is finished!
     $this->search->update(['finished' => true]);
     return false;
 }