Hi Juan,
I missed this (ZF version), sorry :)
That looks NFS is the problem. Hmm... That's good idea to make lock file path
configurable.
With best regards,
Alexander Veremyev.
________________________________
From: Juan Felipe Alvarez Saldarriaga [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 05, 2007 11:35 AM
To: Alexander Veremyev; [email protected]
Subject: RE: RE: [fw-general] Zend_Search_Lucene - Fatal error when I
try to load it
Hey :)
I write the version of ZFW that use like two mails before :), is ZFW
1.0.1, I talk with our SysAdmin and he told me that the "/home" is on a NFS so,
I'm trying to write the lock on this path
"/home/jfalvarez/projects/my_test_site/tmp" maybe that's the problem, becuase
before all the Lucene implementation that I did works.
Thx Alexander :).
________________________________
From: Alexander Veremyev [EMAIL PROTECTED]
Sent: Tuesday, September 04, 2007 3:38 PM
To: Juan Felipe Alvarez Saldarriaga; [email protected]
Subject: RE: RE: [fw-general] Zend_Search_Lucene - Fatal error when I
try to load it
Hi Juan,
You missed ZF version. It's important info, current SVN version doesn't
use index.lock file, but there was a bug in index.lock processing in some
post-1.0 revision.
Nevertheless, that looks you use ZF 1.0 or 1.0.1.
Which filesystem do you use for the index? flock() is used in
Zend_Search_Lucene to organaze concurrent index processing, but it has
limitations depending on filesystem type (ex. it doesn't work on NFS):
http://ru2.php.net/manual/en/function.flock.php
With best regards,
Alexander Veremyev.
________________________________
From: Juan Felipe Alvarez Saldarriaga [mailto:[EMAIL PROTECTED]
Sent: Saturday, September 01, 2007 12:27 AM
To: Alexander Veremyev; [email protected]
Subject: RE: RE: [fw-general] Zend_Search_Lucene - Fatal error
when I try to load it
I try to follow the example into the framework reference guide,
so this is my code now:
foreach ( $arrItemsData AS $intItemId => $arrItemData )
{
try
{
if ( false === is_dir( LUCENE_INDEX_PATH .
"/{$arrItemData['identifier']}" ) )
{
mkdir( LUCENE_INDEX_PATH .
"/{$arrItemData['identifier']}" );
chmod( LUCENE_INDEX_PATH .
"/{$arrItemData['identifier']}", 0777 );
$objLuceneIndex = Zend_Search_Lucene::create(
LUCENE_INDEX_PATH . "/{$arrItemData['identifier']}" );
}
else
{
$objLuceneIndex = Zend_Search_Lucene::open(
LUCENE_INDEX_PATH . "/{$arrItemData['identifier']}" );
}
$objLuceneDocument = new Zend_Search_Lucene_Document();
$objLuceneDocument->addField(
Zend_Search_Lucene_Field::Text( "url", PAGE_QUERY_STRING .
"/{$arrItemData['page']['identifier']}" ) );
$objLuceneIndex->addDocument( $objLuceneDocument );
}
catch ( Exception $objError )
{
throw new Exception( "This content can't be indexed
({$arrItemData['identifier']} - " . LUCENE_INDEX_PATH .
"/{$arrItemData['identifier']}) ({$objError->getMessage()})" );
}
}
So, the I got the same issues, when the folder where I'll going
to store the index file is not created, and I execute
Zend_Search_Lucene::create method, the system fails, and show me this exception:
Fatal error: Uncaught exception 'Exception' with message
'Can't save this page (This content can't be indexed (en -
/home/jfalvarez/php5/test_project/site/tmp/lucene/en) (Can't create index. It's
under processing now)).'
So at this point, I create the folder where I going to store
this index and if I saw into this folder I have the index.lock file:
[EMAIL PROTECTED]:~/projects/test_project/site/tmp/lucene$ ls
-lR
.:
total 4.0K
drwxrwxrwx 2 www-data www-data 4.0K Aug 31 22:36 en
./en:
total 0
-rw-r--r-- 1 www-data www-data 0 Aug 31 22:36 index.lock
Now I try to save once again this data, and I got a new one
exception:
Fatal error: Uncaught exception 'Exception' with message
'Can't save this page (This content can't be indexed (en -
/home/jfalvarez/php5/test_project/site/tmp/lucene/en) (Can't obtain shared
index lock)).'
I don't know what's going on, the loop at the start of this
email is inside a transaction, but I don't know if this mess all the process.
Thx for any help :).
________________________________
From: Juan Felipe Alvarez Saldarriaga [mailto:[EMAIL PROTECTED]
Sent: MiƩrcoles, 29 de Agosto de 2007 08:20 a.m.
To: Alexander Veremyev; [email protected]
Subject: RE: [fw-general] Zend_Search_Lucene - Fatal error when
I try to load it
1. Im using ZFW 1.0.1, Debian :)
2. Yes, Lucene class is a extended class from
Zend_Search_Lucene.
3. The values are
/home/jfalvarez/projects/my_test_site/tmp/lucene/en and
/home/jfalvarez/projects/my_test_site/tmp/lucene/es (LUCENE_INDEX_PATH ->
/home/jfalvarez/projects/my_test_site/tmp/lucene/) and the identifier value is
"en" or "es", the two languages on my system, Im using the Zend_Locale on my
application too, so I got this to languages identifiers.
I'll try to implement it using "create" and "open" methods, I
hope that works.
Thx :).
________________________________
From: Alexander Veremyev [mailto:[EMAIL PROTECTED]
Sent: MiƩrcoles, 29 de Agosto de 2007 08:52 a.m.
To: Juan Felipe Alvarez Saldarriaga; [email protected]
Subject: RE: [fw-general] Zend_Search_Lucene - Fatal error when
I try to load it
Hi Juan,
1. Please describe, which ZF version and OS you use.
2. Is Lucene class your wrapper around Zend_Search_Lucene? Use
Zend_Search_Lucene::create($indexPath);
and
Zend_Search_Lucene::open($indexPath);
for index creation and opening. It should help at least with
the second problem.
3. Could you test your script using a command line and add some
debug output (check LUCENE_INDEX_PATH . "/{$arrLanguageData['identifier']}"
value)?
With best regards,
Alexander Veremyev.
________________________________
From: Juan Felipe Alvarez Saldarriaga [mailto:[EMAIL
PROTECTED]
Sent: Wednesday, August 29, 2007 12:05 AM
To: [email protected]
Subject: [fw-general] Zend_Search_Lucene - Fatal error
when I try to load it
:)
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.
________________________________
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.
________________________________
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.
________________________________
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.