def makeMasterIndex(self): """ Make the master index for this collection, if it doesn't exist (and if we're supposed to) """ if self.useMaster: contentItems = schema.ns("osaf.pim", self.itsView).contentItems if not contentItems.hasIndex(self.itsName): self.makeIndexOn(contentItems, ContentItem.getKind(self.itsView))
def makeIndex(self, collection): """ Create this index on this collection. """ if self.useMaster: # Make sure the master index exists self.makeMasterIndex() # Create a subindex that inherits from the master contentItems = schema.ns("osaf.pim", self.itsView).contentItems collection.addIndex(self.itsName, 'subindex', superindex=(contentItems, contentItems.__collection__, self.itsName)) else: # Create a standalone index self.makeIndexOn(collection, ContentItem.getKind(self.itsView))