Example #1
0
 public function build()
 {
     if (is_null($this->index)) {
         throw new \Exception("Search Index not defined");
     }
     if (is_null($this->store)) {
         throw new \Exception("Document Store not defined");
     }
     if (is_null($this->tokenizer)) {
         throw new \Exception("Document Tokenizer not defined");
     }
     if (is_null($this->ranker)) {
         throw new \Exception("Document Ranker not defined");
     }
     $this->tokenizer->setStopWords($this->stopWords);
     // Init index from store data
     if ($this->index->size() === 0 && $this->store->size() > 0) {
         $this->index = $this->store->buildIndex($this->index);
     }
     return new Config($this);
 }