Symfonians,

(Yeah I know this is a bit of a FAQ, but I'm stuck, despite all my 
readings).

I have taken[1] a Lucene search facility that works, except that a 
search term that contains an accented character finds nothing. 
Non-accented is fine.

1. from 
http://blog.hma-info.de/2007/09/15/integrating-lucene-into-symfony-a-wrap-up/

class Foo extends BaseFoo
{
   public function updateIndex()
   {
       Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding(
           "UTF-8"
       );
       Zend_Search_Lucene_Analysis_Analyzer::setDefault(
           new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num(),
           new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8Num()
       );

       $doc = new Zend_Search_Lucene_Document();
       $doc->addField(Zend_Search_Lucene_Field::UnIndexed('pk', 
$this->getId()));
       $doc->addField(Zend_Search_Lucene_Field::UnStored('body', 
mb_strtolower($this->getBody()), "UTF-8"));

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

class FooPeer extends BaseFooPeer
{
   static public function runQuery($query)
   {
     $id = array();
     foreach (self::getIndex()->find(mb_strtolower($query, "UTF-8")) as 
$hit)
     {
         $id[] = $hit->pk;
     }
     // do something with all the hits found
   }
}

Dead simple. Except it doesn't work. When I look at the .cfs files on 
disk I see UTF-8-encoded data, so I know it's going in. I just can't 
pull it out. Is there something really obvious I'm missing?

Thanks,
David

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to