Zend Lucene指数

Hello I am trying to build Lucene index. I have problem building index interrupt on server, on localhost works. I found somewhere maybe it's a problem because large number of data I cant figure why. On server I change max_execution time, and time_limit. I am calling this method

static public function indexSearchJedinice($params = null)      
{       
    $debug_file_path = 'c:/wamp/www/linkdl/debug/element.txt';
    $debug_file = fopen($debug_file_path, 'w');
    fwrite($debug_file, 'uso' ."
");
        Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
    // Create index.  Will delete any existing index.
    $index = Zend_Search_Lucene::open('c:/wamp/www/linkdl/lucene/jedinice/');

    $sql = "
            SELECT DISTINCT KNJ.ID, KNJ.Naziv, KNJ.Opis, KNJ.UID
            FROM Kurs as K 
            LEFT JOIN KursPodaci as KP on K.ID = KP.IDKurs
            INNER JOIN KursPripadaGrupi as KPG ON K.ID = KPG.IDKurs
            INNER JOIN PodGrupa ON PodGrupa.ID = KPG.IDPodgrupa
            INNER JOIN KursSadrziNastavneModule ON KursSadrziNastavneModule.IDKurs = K.ID
            INNER JOIN KursModulSadrziJedinicu on KursModulSadrziJedinicu.IDKursNastavniModul = KursSadrziNastavneModule.IDKursNastavniModul
            INNER JOIN KursNastavnaJedinica as KNJ ON KNJ.ID = KursModulSadrziJedinicu.IDKursNastavnaJedinica

            WHERE K.ProdajniStatus IN (0,1) 
            AND KPG.IDCenovnikTip = 2 
            AND KNJ.JeZaPrikazivanje = 0
            ";



    //fwrite($debug_file, $sql ."
");
    if ($jedinice =  Db::getResult($sql))
    {
        foreach ($jedinice as $jedinica)
        {
            //fwrite($debug_file, $jedinica['Naziv'] ."
");
            $doc = new Zend_Search_Lucene_Document();
            $doc->addField(Zend_Search_Lucene_Field::UnIndexed('ID', $jedinica['ID']));
            $doc->addField(Zend_Search_Lucene_Field::Text('Naziv', $jedinica['Naziv'], 'utf-8'));
            $doc->addField(Zend_Search_Lucene_Field::UnStored('Opis', $jedinica['Opis'], 'utf-8'));
            //$doc->addField(Zend_Search_Lucene_Field::UnStored('Opis', '', 'utf-8'));
            $doc->addField(Zend_Search_Lucene_Field::UnIndexed('UID', $jedinica['UID']));
            $doc->addField(Zend_Search_Lucene_Field::UnIndexed('Type', 'jedinica'));

            $kratki_tekst = str_replace(' ', '',  str_replace('U izradi', '', strip_tags($jedinica['Opis'])));
            $kratki_tekst = create_short_text($kratki_tekst, 475);

            $doc->addField(Zend_Search_Lucene_Field::UnIndexed('KratkiOpis', $kratki_tekst, 'utf-8'));

            $index->addDocument($doc);

            /**
             * Optimizacija indeksiranja
            */
            unset($doc);


        }
    }
    fwrite($debug_file, 'Optimizacija pocinje' ."
");
    $index->commit();
    $index->optimize();
    fwrite($debug_file, 'Optimizacija zabrsena' ."
");
    return true;
}

Can someone help me to understand diffrence between open/and create. And this options UnIndexed, UnStored,Text

Create will build new Zend Lucene index for the first time and after creating the index if you need to reopen existing index to manipulate data into it, use open. Refer

I have used following code in my implementation and it works fine: It will first tries to open an index, if index will not be available then it will create a new index.

try {
    $index = Zend_Search_Lucene::open("indexName");
} catch(Exception $e) {
    $index = Zend_Search_Lucene::create("indexName");
} 

Regarding field types refer this

And yes, there is a limit to store data into an index. For 32 bit platforms it is 2 GB. Use 64-bit platforms for larger indices. Source