예제 #1
0
    def process(self, connection):
        if interfaces.DEBUG_LOG: log.info("Deleting %r" % self.document_id)
        instance = self.resolve()
        if ITranslatable.providedBy(instance):
            for lang in languages():
                doc_id = self.get_resolver().id(instance, language=lang.value)
                connection.delete(doc_id)

        else:
            connection.delete(self.document_id)
예제 #2
0
 def process( self, connection ):
     if interfaces.DEBUG_LOG: log.info("Deleting %r"%self.document_id )
     instance = self.resolve()
     if ITranslatable.providedBy(instance):
         for lang in languages():
             doc_id = self.get_resolver().id(instance, language=lang.value)
             connection.delete( doc_id )
             
     else:
         connection.delete( self.document_id )
예제 #3
0
    def process( self, connection ):
        if interfaces.DEBUG_LOG: log.info("Modifying %r"%self.document_id )        
        instance = self.resolve()
#        if not instance or instance == interfaces.OP_REQUEUE:
#            return instance        
        if ITranslatable.providedBy(instance):
            for lang in languages():
                translated_instance = translation.translate_obj(instance, lang=lang.value)
                translated_instance.language = lang.value
                doc = interfaces.IIndexer( translated_instance ).document( connection )
                doc.id = self.get_resolver().id(instance, language=lang.value)       
                doc.fields.append( xappy.Field('resolver', self.resolver_id ) )
                print doc.id
                connection.replace(doc)
        else:
            doc = interfaces.IIndexer( instance ).document( connection )
            doc.id = self.document_id        
            doc.fields.append( xappy.Field('resolver', self.resolver_id ) )
            connection.replace(doc)
예제 #4
0
 def process(self, connection):
     if interfaces.DEBUG_LOG: log.info("Modifying %r" % self.document_id)
     instance = self.resolve()
     #        if not instance or instance == interfaces.OP_REQUEUE:
     #            return instance
     if ITranslatable.providedBy(instance):
         for lang in languages():
             translated_instance = translation.translate_obj(
                 instance, lang=lang.value)
             translated_instance.language = lang.value
             doc = interfaces.IIndexer(translated_instance).document(
                 connection)
             doc.id = self.get_resolver().id(instance, language=lang.value)
             doc.fields.append(xappy.Field('resolver', self.resolver_id))
             print doc.id
             connection.replace(doc)
     else:
         doc = interfaces.IIndexer(instance).document(connection)
         doc.id = self.document_id
         doc.fields.append(xappy.Field('resolver', self.resolver_id))
         connection.replace(doc)