Hi Craig,

It wasn't necessary to rebuild index.
Apache Lucene file format is system and encoding independent. Data is stored in UTF-8 ("Modified UTF-8") internally. So the fact that you have correct search result on some system exactly means that index is correct and you can copy this index to any other system.

Your CentOS system has 'en_US.UTF-8' as a default locale.
I am sure you gave data for indexing also in UTF-8. So real data encoding matched used locale and you got correct index.

Then you searched the index with some query. I am sure it also was in UTF-8 and it also matched used locale.

After you had moved index to Solaris system you didn't make any change in the application to correspond changed default locale (I think).

So you have only next options to solve this:
a) convert data for indexing and query into current locale encoding
b) change current locale with setlocale() to match actual data encoding
c) explicitly specify actual encoding for indexed data (field creation method optional parameter) and query (optional parameter of parse() method and configurable default encoding query parser setting). See examples from previous message.

Which method should be used? That's your choice :)


With best regards,
   Alexander Veremyev.


Duncan, Craig wrote:
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