AdvancedStarting from 1.6, handling index format transformationsZend_Search_Lucene component works with Java Lucene 1.4-1.9, 2.1 and 2.3 index formats.
Current index format may be requested using
Index modifications are performed only if any index update is done.
That happens if a new document is added to an index or index optimization is started
manually by In a such case Zend_Search_Lucene may convert index to the higher format version. That always happens for the indices in Zend_Search_Lucene::FORMAT_PRE_2_1 format, which are automatically converted to 2.1 format.
You may manage conversion process and assign target index format by
Backward conversions are not supported.
Using the index as static propertyThe Zend_Search_Lucene object uses the destructor method to commit changes and clean up resources.
It stores added documents in memory and dumps new index segment to disk depending on
If Static object properties (see below) are destroyed after the last line of the executed script.
All the same, the destructor for static properties is correctly invoked at this point in the program's execution. One potential problem is exception handling. Exceptions thrown by destructors of static objects don't have context, because the destructor is executed after the script has already completed. You might see a "Fatal error: Exception thrown without a stack frame in Unknown on line 0" error message instead of exception description in such cases. Zend_Search_Lucene provides a workaround to this problem with the commit() method. It saves all unsaved changes and frees memory used for storing new segments. You are free to use the commit operation any time- or even several times- during script execution. You can still use the Zend_Search_Lucene object for searching, adding or deleting document after the commit operation. But the commit() call guarantees that if there are no document added or deleted after the call to commit(), then the Zend_Search_Lucene destructor has nothing to do and will not throw exception:
|