:)
I have this situation:
* Two index files, one for english and one for spanish content,
(/home/jfalvarez/projects/my_test_site/tmp/lucene/en -
/home/jfalvarez/projects/my_test_site/tmp/lucene/es), this index files are
created using this portion of code:
foreach ( $arrSystemLanguages AS $intLanguageId => $arrLanguageData )
{
// If the Lucene language folder is not created, then try to make an mkdir
and set permissions over the new folder.
if ( false === is_dir( LUCENE_INDEX_PATH .
"/{$arrLanguageData['identifier']}" ) )
{
try
{
// Create filesystem folder.
mkdir( LUCENE_INDEX_PATH . "/{$arrLanguageData['identifier']}" );
// Set language folder permissions.
chmod( LUCENE_INDEX_PATH . "/{$arrLanguageData['identifier']}", 0777 );
// And now we try to create the Lucene index file per language folder! :D.
$objLuceneIndex = Lucene::create( LUCENE_INDEX_PATH .
"/{$arrLanguageData['identifier']}" );
// Load a new document, a blank document.
$objLuceneDocument = new Zend_Search_Lucene_Document();
// Set this blank document to the index created.
$objLuceneIndex->addDocument( $objLuceneDocument );
}
catch ( Exception $objError )
{
throw new Exception( "Can't create Lucene language folder for
{$arrLanguageData['name']} - ({$objError->getMessage()})" );
}
}
}
When I execute this at the first time, I always have this error: "Can't create
index. It's under processing now", ok, I refresh the page like two time (for
the two languages on my application) and now the page works.
So, when I try to add data to the both index I always got this exception error:
"Can't obtain shared index lock".
Im using something like this:
foreach ( $arrSystemLanguages AS $intLanguageId => $arrLanguageData )
{
// Load Lucene lib.
$objLucene = new Lucene( LUCENE_INDEX_PATH .
"/{$arrLanguageData['identifier']}" );
// Add fields ...
// Save document ...
}
I look into the Zend_Search_Lucene library and that error appears when I
instantiate the object, I need to "destroy" the object every time or something ?
Thx for any help.
________________________________
This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system. E-mail transmission cannot be guaranteed to be
secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender therefore
does not accept liability for any errors or omissions in the contents of this
message, which arise as a result of e-mail transmission. If verification is
required please request a hard-copy version.