Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-12456

Class based delayed indexing

    XMLWordPrintable

Details

    Description

      It would be nice to have a class based indexing which allows to delay the indexing for certain classes.
      This is helpful if e.g. large PDF files will be uploaded. The parsing of the PDF takes a long time and may timeout. On the other hand forum entries should be indexed directly , to have the information present.

      The patch for this:

      Index: ezpublish_40/kernel/content/ezcontentoperationcollection.php
      ===================================================================
      --- ezpublish_40/kernel/content/ezcontentoperationcollection.php        (Revision 29488)
      +++ ezpublish_40/kernel/content/ezcontentoperationcollection.php        (Revision 29489)
      @@ -570,27 +570,39 @@
               //include_once( "lib/ezutils/classes/ezini.php" );
      
               $ini = eZINI::instance( 'site.ini' );
      -        $delayedIndexing = ( $ini->variable( 'SearchSettings', 'DelayedIndexing' ) == 'enabled' );
      +        $delayedIndexing = $ini->variable( 'SearchSettings', 'DelayedIndexing' );
      
      -        if ( $delayedIndexing )
      +
      +        if ( $delayedIndexing == 'enabled' )
               {
                   //include_once( "lib/ezdb/classes/ezdb.php" );
      
                   $db = eZDB::instance();
                   $db->query( 'INSERT INTO ezpending_actions( action, param ) VALUES ( \'index_object\', '. (int)$objectID. ' )' );
      +            return;
               }
      -        else
      +        elseif ( $delayedIndexing == 'classbased' )
               {
      -            //include_once( "kernel/classes/ezsearch.php" );
      +            $classList = $ini->variable( 'SearchSettings', 'DelayedIndexingClassList' );
      +
                   $object = eZContentObject::fetch( $objectID );
      -            // Register the object in the search engine.
      -            eZDebug::accumulatorStart( 'remove_object', 'search_total', 'remove object' );
      -            eZSearch::removeObject( $object );
      -            eZDebug::accumulatorStop( 'remove_object' );
      -            eZDebug::accumulatorStart( 'add_object', 'search_total', 'add object' );
      -            eZSearch::addObject( $object );
      -            eZDebug::accumulatorStop( 'add_object' );
      +            $classIdentifier = $object->attribute( 'class_identifier' );
      +            if ( is_array( $classList ) && in_array( $classIdentifier, $classList ) )
      +            {
      +                $db = eZDB::instance();
      +                $db->query( 'INSERT INTO ezpending_actions( action, param ) VALUES ( \'index_object\', '. (int)$objectID. ' )' );
      +                return;
      +            }
               }
      +        //include_once( "kernel/classes/ezsearch.php" );
      +        $object = eZContentObject::fetch( $objectID );
      +        // Register the object in the search engine.
      +        eZDebug::accumulatorStart( 'remove_object', 'search_total', 'remove object' );
      +        eZSearch::removeObject( $object );
      +        eZDebug::accumulatorStop( 'remove_object' );
      +        eZDebug::accumulatorStart( 'add_object', 'search_total', 'add object' );
      +        eZSearch::addObject( $object );
      +        eZDebug::accumulatorStop( 'add_object' );
           }
      
           /*!
      Index: ezpublish_40/settings/site.ini
      ===================================================================
      --- ezpublish_40/settings/site.ini      (Revision 29488)
      +++ ezpublish_40/settings/site.ini      (Revision 29489)
      @@ -330,8 +330,11 @@
       # Do not search words which are present in more than StopWordThresholdPercent % of total objects
       StopWordThresholdPercent=60
       # Controls whether objects are indexed when they are published, or delayed
      -# and processed later by a cronjob
      +# and processed later by a cronjob, can be set class based via 'classbased'
      +# In this case DelayedIndexingClassList should be set with class identifiers
       DelayedIndexing=disabled
      +# List of class identifiers to use delayed indexing with.
      +DelayedIndexingClassList[]
       # Search extension path list. Add extension name where the search plug-in is
       # located to this list.
       ExtensionDirectories[]
      

      Attachments

        Activity

          People

            qwix qwix
            dis dis
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: