Commit bbb58095 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Support queued indexing.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@2004 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2264ab3a
No related merge requests found
...@@ -1376,7 +1376,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -1376,7 +1376,7 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
""" """
if self.isIndexable: if self.isIndexable:
#LOG("immediateReindexObject",0,self.getRelativeUrl()) #LOG("immediateReindexObject",0,self.getRelativeUrl())
PortalContent.reindexObject(self) PortalContent.reindexObject(self, *args, **kw)
else: else:
pass pass
#LOG("No reindex now",0,self.getRelativeUrl()) #LOG("No reindex now",0,self.getRelativeUrl())
...@@ -1391,7 +1391,24 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -1391,7 +1391,24 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
args / kw required since we must follow API args / kw required since we must follow API
""" """
if self.isIndexable: if self.isIndexable:
self.activate().immediateReindexObject() self.activate().immediateReindexObject(*args, **kw)
def immediateQueueCataloggedObject(self, *args, **kw):
if self.isIndexable:
catalog_tool = getToolByName(self, 'portal_catalog', None)
if catalog_tool is not None:
catalog_tool.queueCataloggedObject(self, *args, **kw)
security.declarePublic('queueCataloggedObject')
def queueCataloggedObject(self, *args, **kw):
"""
Index an object in a deferred manner.
"""
if self.isIndexable:
self.activate().immediateQueueCataloggedObject(*args, **kw)
security.declarePublic('recursiveQueueCataloggedObject')
recursiveQueueCataloggedObject = queueCataloggedObject
security.declareProtected( Permissions.AccessContentsInformation, 'asXML' ) security.declareProtected( Permissions.AccessContentsInformation, 'asXML' )
def asXML(self, ident=0): def asXML(self, ident=0):
......
...@@ -429,25 +429,25 @@ be a problem).""" ...@@ -429,25 +429,25 @@ be a problem)."""
# Catalog related # Catalog related
security.declarePublic( 'reindexObject' ) security.declarePublic( 'reindexObject' )
def reindexObject(self, idxs=[]): def reindexObject(self, *args, **kw):
""" """
Fixes the hierarchy structure (use of Base class) Fixes the hierarchy structure (use of Base class)
XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX
BUG here : when creating a new base category BUG here : when creating a new base category
""" """
return Base.reindexObject(self) return Base.reindexObject(self, *args, **kw)
security.declarePublic( 'recursiveReindexObject' ) security.declarePublic( 'recursiveReindexObject' )
def recursiveReindexObject(self): def recursiveReindexObject(self, *args, **kw):
""" """
Fixes the hierarchy structure (use of Base class) Fixes the hierarchy structure (use of Base class)
XXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX
BUG here : when creating a new base category BUG here : when creating a new base category
""" """
self.activate().recursiveImmediateReindexObject() self.activate().recursiveImmediateReindexObject(*args, **kw)
security.declarePublic( 'recursiveImmediateReindexObject' ) security.declarePublic( 'recursiveImmediateReindexObject' )
def recursiveImmediateReindexObject(self): def recursiveImmediateReindexObject(self, *args, **kw):
""" """
Applies immediateReindexObject recursively Applies immediateReindexObject recursively
""" """
...@@ -455,11 +455,26 @@ be a problem).""" ...@@ -455,11 +455,26 @@ be a problem)."""
self.flushActivity(invoke = 0, method_id='immediateReindexObject') # This might create a recursive lock self.flushActivity(invoke = 0, method_id='immediateReindexObject') # This might create a recursive lock
self.flushActivity(invoke = 0, method_id='recursiveImmediateReindexObject') # This might create a recursive lock self.flushActivity(invoke = 0, method_id='recursiveImmediateReindexObject') # This might create a recursive lock
if self.isIndexable: if self.isIndexable:
self.immediateReindexObject() self.immediateReindexObject(*args, **kw)
# Reindex contents # Reindex contents
for c in self.objectValues(): for c in self.objectValues():
if hasattr(aq_base(c), 'recursiveImmediateReindexObject'): if hasattr(aq_base(c), 'recursiveImmediateReindexObject'):
c.recursiveImmediateReindexObject() c.recursiveImmediateReindexObject(*args, **kw)
security.declarePublic( 'recursiveQueueCataloggedObject' )
def recursiveQueueCataloggedObject(self, *args, **kw):
"""
Apply queueCataloggedObject recursively
"""
# Index self
self.flushActivity(invoke = 0, method_id='queueCataloggedObject') # This might create a recursive lock
self.flushActivity(invoke = 0, method_id='recursiveQueueCataloggedObject') # This might create a recursive lock
if self.isIndexable:
self.queueCataloggedObject(*args, **kw)
# Index contents
for c in self.objectValues():
if hasattr(aq_base(c), 'recursiveQueueCataloggedObject'):
c.recursiveQueueCataloggedObject(*args, **kw)
security.declareProtected( Permissions.ModifyPortalContent, 'recursiveMoveObject' ) security.declareProtected( Permissions.ModifyPortalContent, 'recursiveMoveObject' )
def recursiveMoveObject(self): def recursiveMoveObject(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment