The locales were indeed different, CentOS was using "LANG=en_US.UTF-8"
and Solaris was set to "LANG=C". After reviewing what was available on
both, I chose "en_US" and recreated my index on CentOS.

As soon as I tried to search the index on CentOS, I get the same error
notice that I had received on Solaris and the script returned zero hits.
 
I will play around with this a little bit more and see if I can get this
to work using one of the locale encodings.

Thanks Andre!

Craig Duncan
PH: 919.379.9144

-----Original Message-----
From: Alexander Veremyev [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 04, 2007 5:09 PM
To: Duncan, Craig
Cc: [email protected]
Subject: Re: [fw-general] Zend_Search fails on Solaris

Hi Craig,

I think the problem is in the current locale. It doesn't match actual 
query string encoding.

Which locales are used for CentOS and Solaris?
That's possible you have to set locale with:
-----
setlocale(LC_ALL, 'your_locale.encoding');
---


Alternative way is to set encoding explicitly.

You may:
1. Set default encoding for query parsing
------------
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding($encoding);

$hits = $index->find($query);
-------

2. Parse query with specified encoding
------------
$parsedQuery = Zend_Search_Lucene_Search_QueryParser::parse($query, 
$encoding);

$hits = $index->find($parsedQuery);
-------


PS The same problem may appear for index creation/update.
Set appropriate current locale or use optional 'encoding' parameter of 
field creation methods:
-----------
$doc = new Zend_Search_Lucene_Document();

$doc->addField(Zend_Search_Lucene_Field::Text($name, $vaule, 
$valueEncoding));
...
-------

With best regards,
    Alexander Veremyev.

Duncan, Craig wrote:
> -->
> 
> Created a search index on local dev box (CentOS) which works fine. But

> after copying the index to our Solaris production server, searching
the 
> index fails with this error.
> 
> <b>Notice</b>:  iconv_strlen() [<a
href='function.iconv-strlen'>function.iconv-strlen</a>]: Unknown error
(22) in
<b>/usr/local/Zend/apache2/oeportal/Zend/Search/Lucene/Search/QueryLexer
.php</b> on line <b>346</b>
> 
>  
> 
> I tried recreating the index on the Solaris box and got about a dozen
or so "iconv() unknown error" messages per document. We are running Zend
Core for Oracle on both boxes but I noticed the libraries were a little
different from php_info(). Both have lib version 1.9, but there
implementation is different.
> 
>  
> 
> On Solaris: iconv implementation libiconv
> 
> On Linux:   iconv implementation glibc
> 
>  
> 
> Is this the real issue? I found the following note in the docs as it
appears relevant:
> 
>  
> 
> "Note that the iconv function on some systems may not work as you
expect. In such case, it'd be a good idea to install the > GNU libiconv
<http://www.gnu.org/software/libiconv/> library. It will most likely end
up with more consistent results."
> 
>  
> 
>  
> 
> Craig Duncan
> 
> PH: 919.379.9144
> 
> 6501 Weston Parkway
> 
> Suite 340
> 
> Cary, NC 27513
> 
>  
> 


Reply via email to