Zend Search Lucene and Persian!

I have the following code in my zf project:

$index = Zend_Search_Lucene::open(APPLICATION_PATH . '/cache/search_index');
        $doc = new Zend_Search_Lucene_Document();

        $title = "سلام سینا xxx sad";



        $doc->addField(Zend_Search_Lucene_Field::Text('title', $title));

        $index->addDocument($doc);
        $index->commit();

        $index->optimize();
        echo "Index contains " . $index->count() . " documents.\n\n";
        $results = $index->find('xxx');
        foreach ($results as $res) {


            var_dump($res->title);
        }

when var_dump does the output → line (39) "سی † † ا جا † † xxx sad"

when user user utf_decode line (25) "س? ا? س ?? ا xxx sad"

how can i decode this correctly !: (

I already used the solution in this SOF question - > lucene coding problem in zend framework

but not working and iconv notification error added!

Help plz :)

+5
source share
1 answer

Fixed by this code:

$index = Zend_Search_Lucene::open(APPLICATION_PATH . '/cache/search_index');
    $doc = new Zend_Search_Lucene_Document();

    $title = "سلام سینا xxx sad";



    $doc->addField(Zend_Search_Lucene_Field::Text('title', $title,"UTF8"));

    $index->addDocument($doc);
    $index->commit();

    $index->optimize();
    echo "Index contains " . $index->count() . " documents.\n\n";



    var_dump($index->getDocument(9));

    echo "Search";
     $results = $index->find('سینا');
   foreach ($results as $res) {


        var_dump($res->title);
    }

    die(1); 
0
source