/adapter/con il nome del file così strutturato:
Adapter_Search_Lucene_Document_<EXT>.php
/adapter/ Adapter_Search_Lucene_Document_RTF.php
/adapter/ Adapter_Search_Lucene_Document_Abstarct.php
e creata la classe con lo stesso nome del file (senza .php) che estende la classe sopradescritta.
class Adapter_Search_Lucene_Document_RTF extends Adapter_Search_Lucene_Document_Abstract { public function __construct() { parent::__construct(); } public function loadParserFile() { // creazione del Bean $this->indexValues = new LuceneDataIndexBean(); // recupero il contenuto dal file $data = mioMetodoRecuperaContenutoFile(); if ($data === ‘’) { require_once 'Adapter_Search_Lucene_Exception.php'; throw new Adapter_Search_Lucene_Exception(' Empty body '); } $this->indexValues->setBody($data); return $this->indexValues->getLuceneDocument(); } }
basterà implementare il metodo dell’interfaccia Adatpter_Search_Lucene_Document_Interface “loadParseFile” . Il metodo deve restituire un oggetto Zend_Search_Lucene_Document.
Va ricordato che l’oggetto Zend_Search_Lucene_Document deve ritornare un field “body” valorizzato per non mandare in eccezione il processo di indicizzazione.
![]() IFile by isApp.it ![]() November 2013 |