Hey J

Thx, I change it to Keyword and now works fine, Ill look that link J

Thx once again.

From: Alexander Veremyev [mailto:[EMAIL PROTECTED]
Sent: MiƩrcoles, 12 de Septiembre de 2007 12:47 p.m.
To: Juan Felipe Alvarez Saldarriaga; [email protected]
Subject: RE: [fw-general] Zend_Search_Lucene - Removing items from the index 
issue.

Hi Juan,

Field must be indexed to be searchable (but may be non-tokenized). Use Keyword 
field type for ids.


PS termDocs() method is much more effective for retrieving documents by given 
id:
-----------------------------------------------
$pageIdTerm = new Zend_Search_Lucene_Index_Term($intPageId, 'page_id');
$docsToDelete = $this->objLuceneIndex->termDocs($pageIdTerm);

if (sizeof($docsToDelete) == 1) {
    $this->objLuceneIndex->delete(reset($docsToDelete));
} ...
-----------------
Some other tips could be found here 
http://framework.zend.com/manual/en/zend.search.lucene.best-practice.html ;)


With best regards,
   Alexander Veremyev.


________________________________
From: Juan Felipe Alvarez Saldarriaga [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 12, 2007 12:16 PM
To: [email protected]
Subject: [fw-general] Zend_Search_Lucene - Removing items from the index issue.
J

Im trying to remove an item for some Lucene index where is set data, so Im 
adding a field with the "id" of the data that I already save into the database 
(Im saving this field as "UnIndexed") into the Lucene index like this:

// Add "UnIndexed" field to the Lucene index document.
$this->objLuceneDocument->addField( Zend_Search_Lucene_Field::UnIndexed( 
"page_id", $intPageId) );

// Add "Text" field to the Lucene index content.
$this->objLuceneDocument->addField( Zend_Search_Lucene_Field::Text( "title", 
$strPageTitle ) );

So when I try to remove it I have this code (thx to MarkSchmidt on #zftalk at 
freenode):

// Load Zend_Search_Lucene_Search_Query_MultiTerm lib.
$objQueryMultiTerm = new Zend_Search_Lucene_Search_Query_MultiTerm();

// Add term to the query.
$objQueryMultiTerm->addTerm( new Zend_Search_Lucene_Index_Term( 
$intPageId,"page_id" ), true );

// Now try to find something.
$objLuceneQueryHits = $this->objLuceneIndex->find( $objQueryMultiTerm );

// If we find just one hit, try to delete it.
if ( sizeof( $objLuceneQueryHits ) == 1 )
{
$this->objLuceneIndex->delete( $objLuceneQueryHits[0]->id );
}
// If we found more than one result, that's rare :|.
else if ( sizeof( $objLuceneQueryHits ) > 1 )
{
throw new Exception( "There's more than one element for "page_id" using this 
term: {$intPageId }." );
}

The problem is this, the $objLuceneQueryHits is empty, so I can't find this 
item into the index using the field "page_id" as UnIndexed, but if I search by 
some other Lucene field, like the "title" as Text, I found it, I don't know if 
the "UnIndexed" Lucene field is the cuase to not find anything.

Somebody can help me on this ? Thx.

________________________________
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.

No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.485 / Virus Database: 269.13.15/1002 - Release Date: 11.09.2007 
17:46


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.485 / Virus Database: 269.13.15/1002 - Release Date: 11.09.2007 
17:46

________________________________
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.

Reply via email to