Changeset 46940

Show
Ignore:
Timestamp:
07/05/06 17:12:24 (2 years ago)
Author:
lregebro
Message:

By disabling the multilanguage support, reindexing speeds up significantly.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • CPS3/products/CPSLuceneCatalog/trunk/CHANGES

    r46872 r46940  
    44New features: 
    55~~~~~~~~~~~~~ 
    6 
     6- A multilanguage_support property is introduced on the catalog, defaulting 
     7  to "True". If set to "False" this skips trying to find all language versions 
     8  of a proxy an unindex them. This significantly speeds up reindexing. 
     9  Also, when manage_reindexProxies this property is always turned off, as 
     10  all language versions will be reindexed anyway. 
    711Bug fixes: 
    812~~~~~~~~~~ 
  • CPS3/products/CPSLuceneCatalog/trunk/catalog.py

    r46869 r46940  
    6969 
    7070    security = ClassSecurityInfo() 
     71     
     72    multilanguage_support = 1 
     73     
     74 
    7175 
    7276    def __init__(self): 
     
    300304 
    301305        # We reindex a normal proxy. 
    302         # Find what languages are in the catalog for this proxy 
    303         uid_view = uid + '/' + cpsutils.KEYWORD_VIEW_LANGUAGE 
    304306        had_languages = [] 
    305  
    306  
    307         for brain in self.unrestrictedSearchResults(path=uid_view): 
    308             path = brain.getPath() 
    309             had_languages.append(path[path.rindex('/')+1:]) 
     307        if self.multilanguage_support: 
     308            # Find what languages are in the catalog for this proxy 
     309            uid_view = uid + '/' + cpsutils.KEYWORD_VIEW_LANGUAGE 
     310            for brain in self.unrestrictedSearchResults(path=uid_view): 
     311                path = brain.getPath() 
     312                had_languages.append(path[path.rindex('/')+1:]) 
    310313 
    311314        # Do we now have only one language? 
     
    357360    # 
    358361 
    359     # Those properties are here only to display the values in ZMI. 
     362    # The server_url properties are here only to display the values in ZMI. 
    360363    # The actual used properties are on the nuxeo.lucene catalog 
    361364    # utility 
     
    366369                    'label':'xml-rpc server URL', 
    367370                    }, 
    368                    ) 
     371                    {'id':'multilanguage_support', 
     372                    'type':'boolean', 
     373                    'mode':'w', 
     374                    'label':'Multi-language support', 
     375                    },                   ) 
    369376 
    370377    manage_options = (CatalogTool.manage_options[2], 
     
    410417 
    411418        portal = utool.getPortalObject() 
     419         
     420        # When reindexing the WHOLE catalog, as we do here, the language 
     421        # support is pointless, as it's there to reindex all languages of a  
     422        # proxy, even when you reindex only one of them. Here they all get 
     423        # reindexed sooner or later anyway: 
     424         
     425        if self.multilanguage_support: 
     426            self.multilanguage_support = False 
     427            enable_multilanguage_support = True 
     428        else: 
     429            enable_multilanguage_support = False 
    412430 
    413431#        rpaths = ('/gcac_preprod/sections/ouvrages/ouvrage-test-eba',) 
     
    448466        stop = time.time() 
    449467        LOG.info("Reindexation done in %s secondes" % str(stop-start)) 
     468         
     469        # Reset the multi_language_support: 
     470        if enable_multilanguage_support: 
     471            self.multilanguage_support = True 
    450472 
    451473        # Optimize the store