public function testCreate()
 {
     $directory = new \ZendSearch\Lucene\Storage\Directory\Filesystem(__DIR__ . '/_source/_files');
     $stiFile = $directory->getFileObject('_1.sti');
     $stiFileData = $stiFile->readBytes($directory->fileLength('_1.sti'));
     // Load dictionary index data
     list($termDictionary, $termDictionaryInfos) = unserialize($stiFileData);
     $segmentInfo = new \ZendSearch\Lucene\Index\SegmentInfo($directory, '_1', 2);
     $tiiFile = $segmentInfo->openCompoundFile('.tii');
     $tiiFileData = $tiiFile->readBytes($segmentInfo->compoundFileLength('.tii'));
     // Load dictionary index data
     list($loadedTermDictionary, $loadedTermDictionaryInfos) = \ZendSearch\Lucene\Index\DictionaryLoader::load($tiiFileData);
     $this->assertTrue($termDictionary == $loadedTermDictionary);
     $this->assertTrue($termDictionaryInfos == $loadedTermDictionaryInfos);
 }
Beispiel #2
0
 function __construct($directory, $lang = 'en', $highlight = true)
 {
     switch ($lang) {
         case 'en':
         default:
             ZendSearch\Lucene\Analysis\Analyzer\Analyzer::setDefault(new StandardAnalyzer_Analyzer_Standard_English());
             ZendSearch\Lucene\Search\QueryParser::setDefaultEncoding('UTF-8');
     }
     ZendSearch\Lucene\Storage\Directory\Filesystem::setDefaultFilePermissions(0660);
     $this->directory = $directory;
     $this->lastModif = file_exists($directory) ? filemtime($directory) : 0;
     $this->highlight = (bool) $highlight;
 }