Introducción a Zend Framework

 Aprendiendo Zend Framework


 Referencia de Zend Framework

  • Zend_Gdata
  • Zend_Http
  • Zend_InfoCard
  • Zend_Json
  • Zend_Layout
  • Zend_Ldap
  • Zend_Loader
  • Zend_Locale
  • Zend_Log
  • Zend_Mail
  • Zend_Markup
  • Zend_Measure
  • Zend_Memory
  • Zend_Mime
  • Zend_Navigation
  • Zend_Oauth
  • Zend_OpenId
  • Zend_Paginator
  • Zend_Pdf
  • Zend_ProgressBar
  • Zend_Queue
  • Zend_Reflection
  • Zend_Registry
  • Zend_Rest

  • Zend_Search_Lucene
  • Zend_Serializer
  • Zend_Server
  • Zend_Service
  • Zend_Session
  • Zend_Soap
  • Zend_Tag
  • Zend_Test
  • Zend_Text
  • Zend_TimeSync
  • Zend_Tool
  • Zend_Tool_Framework
  • Zend_Tool_Project
  • Zend_Translate
  • Zend_Uri
  • Zend_Validate
  • Zend_Version
  • Zend_View
  • Zend_Wildfire
  • Zend_XmlRpc
  • ZendX_Console_Process_Unix
  • ZendX_JQuery
  • Traducción al 26.9% - Actualizado el 2011-11-16 - Revisión 24249 - Versión ZF 1.11.x

    10.2. Lucene Index Structure

    In order to fully utilize Zend_Search_Lucene's capabilities with maximum performance, you need to understand it's internal index structure.

    An index is stored as a set of files within a single directory.

    An index consists of any number of independent segments which store information about a subset of indexed documents. Each segment has its own terms dictionary, terms dictionary index, and document storage (stored field values) [3]. All segment data is stored in _xxxxx.cfs files, where xxxxx is a segment name.

    Once an index segment file is created, it can't be updated. New documents are added to new segments. Deleted documents are only marked as deleted in an optional <segmentname>.del file.

    Document updating is performed as separate delete and add operations, even though it's done using an update() API call [4]. This simplifies adding new documents, and allows updating concurrently with search operations.

    On the other hand, using several segments (one document per segment as a borderline case) increases search time:

    • retrieving a term from a dictionary is performed for each segment;

    • the terms dictionary index is pre-loaded for each segment (this process takes the most search time for simple queries, and it also requires additional memory).

    If the terms dictionary reaches a saturation point, then search through one segment is N times faster than search through N segments in most cases.

    Index optimization merges two or more segments into a single new one. A new segment is added to the index segments list, and old segments are excluded.

    Segment list updates are performed as an atomic operation. This gives the ability of concurrently adding new documents, performing index optimization, and searching through the index.

    Index auto-optimization is performed after each new segment generation. It merges sets of the smallest segments into larger segments, and larger segments into even larger segments, if we have enough segments to merge.

    Index auto-optimization is controlled by three options:

    • MaxBufferedDocs (the minimal number of documents required before the buffered in-memory documents are written into a new segment);

    • MaxMergeDocs (the largest number of documents ever merged by an optimization operation); and

    • MergeFactor (which determines how often segment indices are merged by auto-optimization operations).

    If we add one document per script execution, then MaxBufferedDocs is actually not used (only one new segment with only one document is created at the end of script execution, at which time the auto-optimization process starts).

    [3] Starting with Lucene 2.3, document storage files can be shared between segments; however, Zend_Search_Lucene doesn't use this capability

    [4] This call is provided only by Java Lucene now, but it's planned to extend the Zend_Search_Lucene API with similar functionality

    digg delicious meneame google twitter technorati facebook