item; } /* * Lucene fulltext */ public function updateLuceneIndex() { $index = $this->getTable()->getLuceneIndex(); // remove existing entries foreach ($index->find('pk:'.$this->getId()) as $hit) { $index->delete($hit->id); } $doc = new Zend_Search_Lucene_Document(); // store job primary key to identify it in the search results $doc->addField(Zend_Search_Lucene_Field::Keyword('pk', $this->getId())); // index job fields $doc->addField(Zend_Search_Lucene_Field::UnStored('item', $this->item, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('dealer_name', $this->dealer_name, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('color', $this->color, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('price', $this->price, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('numberplate', $this->numberplate, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('serialnumber', $this->serialnumber, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('vintage', $this->vintage, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('deposit', $this->deposit, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('price_funding', $this->price_funding, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('price_payment', $this->price_payment, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('agency_name', $this->agency_name, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('agency_person', $this->agency_person, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_code', $this->guarantee_code, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_name', $this->guarantee_name, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_cell', $this->guarantee_cell, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_address_street', $this->guarantee_address_street, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_address_city', $this->guarantee_address_city, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_address_zipcode', $this->guarantee_address_zipcode, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_address_cell', $this->guarantee_address_cell, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_address_phone', $this->guarantee_address_phone, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_address_phone2', $this->guarantee_address_phone2, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_altaddress_street', $this->guarantee_altaddress_street, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_altaddress_city', $this->guarantee_altaddress_city, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_altaddress_zipcode', $this->guarantee_altaddress_zipcode, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_altaddress_cell', $this->guarantee_altaddress_cell, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_altaddress_phone', $this->guarantee_altaddress_phone, 'UTF-8')); $doc->addField(Zend_Search_Lucene_Field::UnStored('guarantee_altaddress_phone2', $this->guarantee_altaddress_phone2, 'UTF-8')); // add job to the index $index->addDocument($doc); $index->commit(); } // pretizeni ukladani pro zpracovani indexu public function save(Doctrine_Connection $conn = null){ $ret = parent::save($conn); $this->updateLuceneIndex(); return $ret; } }